Some performance improvement

This commit is contained in:
barsdeveloper
2022-05-12 22:09:17 +02:00
parent ddb8138cd4
commit 4a6b021e0c
8 changed files with 87 additions and 46 deletions

View File

@@ -18,4 +18,27 @@ export default class LinearColorEntity extends IEntity {
/** @type {Number} */ this.B
/** @type {Number} */ this.A
}
/**
* @param {Number} number
*/
static numberToString(number) {
return Math.round(number * 255).toString(16)
}
static fromString(value) {
return new LinearColorEntity({
R: parseInt(value.substr(0, 2), 16) / 255,
G: parseInt(value.substr(2, 2), 16) / 255,
B: parseInt(value.substr(4, 2), 16) / 255,
A: parseInt(value.substr(6, 2), 16) / 255,
})
}
toString() {
return "#" + LinearColorEntity.numberToString(this.R)
+ LinearColorEntity.numberToString(this.G)
+ LinearColorEntity.numberToString(this.B)
+ LinearColorEntity.numberToString(this.A)
}
}

View File

@@ -66,7 +66,7 @@ export default class PinEntity extends IEntity {
* }}
*/ this.PinType
/** @type {PinReferenceEntity[]} */ this.LinkedTo
/** @type {String} */ this.DefaultValue
/** @type {String | LinearColorEntity} */ this.DefaultValue
/** @type {String} */ this.AutogeneratedDefaultValue
/** @type {ObjectReferenceEntity} */ this.DefaultObject
/** @type {GuidEntity} */ this.PersistentGuid