@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
138 lines • 4.55 kB
JavaScript
import { __extends } from "tslib";
import { DDialogLayered, DInputLabel, DInputReal, DLayoutHorizontal, DLayoutSpace, DSelect, ESnapperTargetValue, ESnapperTargetValueType } from "@wcardinal/wcardinal-ui";
var EDialogSnap = /** @class */ (function (_super) {
__extends(EDialogSnap, _super);
function EDialogSnap() {
return _super !== null && _super.apply(this, arguments) || this;
}
EDialogSnap.prototype.newContentChildren = function (theme, options) {
var result = _super.prototype.newContentChildren.call(this, theme, options);
result.push(new DLayoutHorizontal({
width: "padding",
height: "auto",
children: [
new DInputLabel({
width: 60,
text: {
value: theme.getSelectDirectionLabel()
}
}),
this.selectType,
new DLayoutSpace({
width: 60
})
]
}));
result.push(new DLayoutHorizontal({
width: "padding",
height: "auto",
children: [
new DInputLabel({
width: 60,
text: {
value: theme.getInputPositionLabel()
}
}),
this.inputPosition,
new DLayoutSpace({
width: 60
})
]
}));
return result;
};
Object.defineProperty(EDialogSnap.prototype, "selectType", {
get: function () {
var result = this._selectType;
if (result == null) {
result = this.newSelectType();
this._selectType = result;
}
return result;
},
enumerable: false,
configurable: true
});
EDialogSnap.prototype.newSelectType = function () {
var theme = this.theme;
return new DSelect({
weight: 1,
value: ESnapperTargetValueType.VERTICAL,
menu: {
items: [
{
value: ESnapperTargetValueType.VERTICAL,
text: {
value: theme.getSelectDirectionValueLabel(ESnapperTargetValueType.VERTICAL)
}
},
{
value: ESnapperTargetValueType.HORIZONTAL,
text: {
value: theme.getSelectDirectionValueLabel(ESnapperTargetValueType.HORIZONTAL)
}
}
]
}
});
};
Object.defineProperty(EDialogSnap.prototype, "inputPosition", {
get: function () {
var result = this._inputPosition;
if (result == null) {
result = this.newInputPosition();
this._inputPosition = result;
}
return result;
},
enumerable: false,
configurable: true
});
EDialogSnap.prototype.newInputPosition = function () {
var _this = this;
return new DInputReal({
weight: 1,
text: {
value: 0
},
step: 1,
on: {
enter: function () {
_this.ok();
}
}
});
};
EDialogSnap.prototype.reset = function () {
this.selectType.value = ESnapperTargetValueType.VERTICAL;
this.inputPosition.value = 0;
return this;
};
Object.defineProperty(EDialogSnap.prototype, "value", {
get: function () {
var type = this.selectType.value;
var position = this.inputPosition.value;
if (type != null) {
return new ESnapperTargetValue(type, position);
}
return null;
},
set: function (value) {
if (value != null) {
this.selectType.value = value.type;
this.inputPosition.value = value.position;
}
},
enumerable: false,
configurable: true
});
EDialogSnap.prototype.getResolvedValue = function () {
return this.value;
};
EDialogSnap.prototype.getType = function () {
return "EDialogSnap";
};
return EDialogSnap;
}(DDialogLayered));
export { EDialogSnap };
//# sourceMappingURL=e-dialog-snap.js.map