mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-15 01:24:41 +08:00
Color picker refactoring
This commit is contained in:
24
js/entity/UnitRealEntity.js
Normal file
24
js/entity/UnitRealEntity.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import IEntity from "./IEntity"
|
||||
import Utility from "../Utility"
|
||||
|
||||
export default class RealUnitEntity extends IEntity {
|
||||
|
||||
static attributes = {
|
||||
value: Number,
|
||||
}
|
||||
|
||||
/** @param {Object | Number | String} options */
|
||||
constructor(options = 0) {
|
||||
super(options)
|
||||
/** @type {Number} */
|
||||
this.value = Utility.clamp(this.value, 0, 1)
|
||||
}
|
||||
|
||||
valueOf() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
toString() {
|
||||
return this.value.toFixed(6)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user