@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
104 lines • 5 kB
JavaScript
import { EShapeActionValueChangeColorType, EShapeActionValueOpetyped, EShapeActionValueSubtyped, EShapeActionValueTransformType, EShapeActionValueType } from "@wcardinal/wcardinal-ui";
var EThemeDefaultShapeActionValue = /** @class */ (function () {
function EThemeDefaultShapeActionValue() {
}
EThemeDefaultShapeActionValue.prototype.toLabel = function (value) {
var type = value.type;
if (value instanceof EShapeActionValueSubtyped) {
var subtype = value.subtype;
if (value instanceof EShapeActionValueOpetyped) {
var result = this.toOpetypedLabel(type, subtype, value.opetype, value);
if (result != null) {
return result;
}
}
else {
var result = this.toSubtypedLabel(type, subtype, value);
if (result != null) {
return result;
}
}
}
return this.toTypedLabel(type, value);
};
EThemeDefaultShapeActionValue.prototype.toTypedLabel = function (type, value) {
return "".concat(this.toTypeLabel(type), ": ").concat(this.toConditionLabel(value.condition));
};
EThemeDefaultShapeActionValue.prototype.toSubtypedLabel = function (type, subtype, value) {
var typeLabel = this.toTypeLabel(type);
switch (type) {
case EShapeActionValueType.SHOW_HIDE:
return "".concat(typeLabel, ": ").concat(this.toShowHideTypeLabel(subtype));
case EShapeActionValueType.BLINK:
return "".concat(typeLabel, ": ").concat(this.toBlinkTypeLabel(subtype));
case EShapeActionValueType.CHANGE_COLOR:
case EShapeActionValueType.CHANGE_COLOR_LEGACY:
return "".concat(typeLabel, ": ").concat(this.toChangeColorTypeLabel(subtype));
case EShapeActionValueType.CHANGE_TEXT:
return "".concat(typeLabel, ": ").concat(this.toChangeTextTypeLabel(subtype));
case EShapeActionValueType.OPEN:
return "".concat(typeLabel, ": ").concat(this.toOpenTypeLabel(subtype));
case EShapeActionValueType.GESTURE:
return "".concat(typeLabel, ": ").concat(this.toGestureTypeLabel(subtype));
case EShapeActionValueType.MISC:
return "".concat(typeLabel, ": ").concat(this.toMiscTypeLabel(subtype));
}
return null;
};
EThemeDefaultShapeActionValue.prototype.toOpetypedLabel = function (type, subtype, opetype, value) {
switch (type) {
case EShapeActionValueType.TRANSFORM:
var subtypeLabel = this.toTransformTypeLabel(subtype);
switch (subtype) {
case EShapeActionValueTransformType.ROTATE:
return "".concat(subtypeLabel, ": ").concat(this.toTransformRotateTypeLabel(opetype));
case EShapeActionValueTransformType.MOVE:
return "".concat(subtypeLabel, ": ").concat(this.toTransformMoveTypeLabel(opetype));
case EShapeActionValueTransformType.RESIZE:
return "".concat(subtypeLabel, ": ").concat(this.toTransformResizeTypeLabel(opetype));
}
}
return null;
};
EThemeDefaultShapeActionValue.prototype.toConditionLabel = function (condition) {
var l = 20;
if (l < condition.length) {
return condition.substring(0, l) + "...";
}
else {
return condition;
}
};
EThemeDefaultShapeActionValue.prototype.toChangeColorTypeLabel = function (type) {
if (type === EShapeActionValueChangeColorType.NONE) {
return this.toChangeColorTypeValueLabel(EShapeActionValueChangeColorType.NONE);
}
var result = "";
var delimiter = "";
if (type & EShapeActionValueChangeColorType.FILL) {
result +=
delimiter + this.toChangeColorTypeValueLabel(EShapeActionValueChangeColorType.FILL);
delimiter = ", ";
}
if (type & EShapeActionValueChangeColorType.STROKE) {
result +=
delimiter +
this.toChangeColorTypeValueLabel(EShapeActionValueChangeColorType.STROKE);
delimiter = ", ";
}
if (type & EShapeActionValueChangeColorType.TEXT) {
result +=
delimiter + this.toChangeColorTypeValueLabel(EShapeActionValueChangeColorType.TEXT);
delimiter = ", ";
}
if (type & EShapeActionValueChangeColorType.TEXT_OUTLINE) {
result +=
delimiter +
this.toChangeColorTypeValueLabel(EShapeActionValueChangeColorType.TEXT_OUTLINE);
}
return result;
};
return EThemeDefaultShapeActionValue;
}());
export { EThemeDefaultShapeActionValue };
//# sourceMappingURL=e-theme-default-shape-action-value.js.map