@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
55 lines • 2.64 kB
JavaScript
import { EShapeActionValueGestureOperationType, EShapeLayerState } from "@wcardinal/wcardinal-ui";
import { EDialogLayerValueBackground } from "./e-dialog-layer-value-background";
var EDialogLayerValue = /** @class */ (function () {
function EDialogLayerValue(name, x, y, width, height, background, visible, interactive, gesture) {
this.name = name;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.background = background;
this.visible = visible;
this.interactive = interactive;
this.gesture = gesture;
}
EDialogLayerValue.prototype.isEqual = function (target) {
return (this.name === target.name &&
this.x === target.x &&
this.y === target.y &&
this.width === target.width &&
this.height === target.height &&
this.background.isEqual(target.background) &&
this.visible === target.visible &&
this.interactive === target.interactive &&
this.gesture === target.gesture);
};
EDialogLayerValue.prototype.copyTo = function (layer) {
layer.name = this.name;
layer.position.set(this.x, this.y);
layer.width = this.width;
layer.height = this.height;
layer.background.copy(this.background);
var state = layer.state;
state.lock();
state.set(EShapeLayerState.INVISIBLE, !this.visible);
state.set(EShapeLayerState.INTERACTIVE, this.interactive);
var gesture = this.gesture;
state.set(EShapeLayerState.DRAGGABLE, !!(gesture & EShapeActionValueGestureOperationType.DRAG));
state.set(EShapeLayerState.PINCHABLE, !!(gesture & EShapeActionValueGestureOperationType.PINCH));
state.unlock();
return this;
};
EDialogLayerValue.from = function (layer) {
var drag = layer.state.is(EShapeLayerState.DRAGGABLE)
? EShapeActionValueGestureOperationType.DRAG
: EShapeActionValueGestureOperationType.NONE;
var pinch = layer.state.is(EShapeLayerState.PINCHABLE)
? EShapeActionValueGestureOperationType.PINCH
: EShapeActionValueGestureOperationType.NONE;
var gesture = drag | pinch;
return new EDialogLayerValue(layer.name, layer.position.x, layer.position.y, layer.width, layer.height, EDialogLayerValueBackground.from(layer), !layer.state.is(EShapeLayerState.INVISIBLE), layer.state.is(EShapeLayerState.INTERACTIVE), gesture);
};
return EDialogLayerValue;
}());
export { EDialogLayerValue };
//# sourceMappingURL=e-dialog-layer-value.js.map