@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
1,100 lines • 37.7 kB
JavaScript
import { __extends } from "tslib";
import { DButtonAmbient, DButtonCheckRight, DButtonColor, DDropdown, DInputReal, DInputRealAndLabel, DInputTextArea, DLayoutHorizontal, DLayoutVertical, DPane, DText, EShapeTextAlignHorizontal, EShapeTextAlignVertical, EShapeTextDirection, EShapeTextStyle, EShapeTextWeight } from "@wcardinal/wcardinal-ui";
import { EEDITOR_BUTTON_COUNT } from "./e-editors";
var EEditorText = /** @class */ (function (_super) {
__extends(EEditorText, _super);
function EEditorText(options) {
var _this = _super.call(this, options) || this;
_this._fromShapeTextRegEx = /\\+n|\n/g;
_this._toShapeTextRegEx = /\\+n/g;
var selection = options.selection;
_this._selection = selection;
var icons = options.icons;
_this._icons = icons;
var theme = _this.theme;
new DLayoutVertical({
parent: _this.content,
x: "padding",
y: "padding",
width: "padding",
height: "auto",
children: [
_this.newLabel(theme.getLabel()),
_this.inputText,
_this.newLabel(theme.getTextFontLabel()),
_this.dropdownFontFamily,
_this.buttonFontColor,
new DLayoutHorizontal({
width: "100%",
height: "auto",
children: [
_this.inputFontSize,
_this.buttonFontSizeDecrease,
_this.buttonFontSizeIncrease,
_this.buttonFontItalic,
_this.buttonFontBold
]
}),
_this.buttonOutline,
_this.buttonOutlineColor,
_this.inputOutlineWidth,
_this.newLabel(theme.getTextAlignLabel()),
new DLayoutVertical({
width: "100%",
height: "auto",
column: EEDITOR_BUTTON_COUNT,
children: [
_this.buttonAlignOutsideLeft,
_this.buttonAlignLeft,
_this.buttonAlignCenter,
_this.buttonAlignRight,
_this.buttonAlignOutsideRight,
_this.buttonAlignOutsideTop,
_this.buttonAlignTop,
_this.buttonAlignMiddle,
_this.buttonAlignBottom,
_this.buttonAlignOutsideBottom,
_this.buttonDirectionLeftToRight,
_this.buttonDirectionTopToBottom,
_this.buttonDirectionBottomToTop,
_this.buttonDirectionRightToLeft
]
}),
_this.buttonClipping,
_this.buttonFitting,
_this.newLabel(theme.getTextSpacingLabel()),
new DLayoutHorizontal({
width: "100%",
children: [_this.inputSpacingHorizontal, _this.inputSpacingVertical]
}),
_this.newLabel(theme.getTextPaddingLabel()),
new DLayoutHorizontal({
width: "100%",
children: [_this.inputPaddingHorizontal, _this.inputPaddingVertical]
}),
_this.newLabel(theme.getTextOffsetLabel()),
new DLayoutHorizontal({
width: "100%",
children: [_this.inputOffsetHorizontal, _this.inputOffsetVertical]
})
]
});
selection.on("change", function () {
_this.onSelectionChange(selection);
});
_this.onSelectionChange(selection);
return _this;
}
EEditorText.prototype.newLabel = function (label) {
return new DText({
width: "100%",
text: {
value: label
}
});
};
Object.defineProperty(EEditorText.prototype, "inputText", {
get: function () {
var result = this._inputText;
if (result == null) {
result = this.newInputText();
this._inputText = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputText = function () {
var _this = this;
return new DInputTextArea({
width: "100%",
height: this.theme.getInputTextHeight(),
text: {
value: ""
},
on: {
input: function (value) {
_this._selection.setText(value);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "dropdownFontFamily", {
get: function () {
var result = this._dropdownFontFamily;
if (result == null) {
result = this.newDropdownFontFamily();
this._dropdownFontFamily = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newDropdownFontFamily = function () {
var _this = this;
return new DDropdown({
width: "100%",
text: {
value: this.fontFamilies.get("auto")
},
menu: {
width: "auto",
column: 3,
fit: false,
items: this.newDropdownFontFamilyMenuItems()
},
on: {
select: function (value) {
var _a;
_this.dropdownFontFamily.text = (_a = _this.fontFamilies.get(value)) !== null && _a !== void 0 ? _a : value;
_this._selection.setTextFamily(value);
}
}
});
};
EEditorText.prototype.newDropdownFontFamilyMenuItems = function () {
var result = [];
this.fontFamilies.forEach(function (label, fontFamily) {
result.push({
width: 200,
value: fontFamily,
text: {
value: label
}
});
});
return result;
};
Object.defineProperty(EEditorText.prototype, "fontFamilies", {
get: function () {
var result = this._fontFamilies;
if (result == null) {
result = this.theme.getFontFamilies();
this._fontFamilies = result;
}
return result;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EEditorText.prototype, "buttonFontColor", {
get: function () {
var result = this._buttonFontColor;
if (result == null) {
result = this.newButtonFontColor();
this._buttonFontColor = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonFontColor = function () {
var _this = this;
var result = new DButtonColor({
width: "100%",
on: {
change: function (value) {
_this._selection.setTextColor(value.color, value.alpha);
}
}
});
result.dialog.on("open", function () {
var dialog = result.dialog;
var dialogNew = dialog.new;
var dialogCurrent = dialog.current;
dialogNew.color = dialogCurrent.color;
dialogNew.alpha = dialogCurrent.alpha;
});
return result;
};
Object.defineProperty(EEditorText.prototype, "inputFontSize", {
get: function () {
var result = this._inputFontSize;
if (result == null) {
result = this.newInputFontSize();
this._inputFontSize = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputFontSize = function () {
var _this = this;
return new DInputReal({
weight: 1,
text: {
value: 0
},
min: 0,
on: {
input: function (size) {
_this._selection.setTextSize(size);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonFontSizeDecrease", {
get: function () {
var result = this._buttonFontSizeDecrease;
if (result == null) {
result = this.newButtonFontSizeDecrease();
this._buttonFontSizeDecrease = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonFontSizeDecrease = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.editor_font_size_decrease
},
title: this.theme.getButtonFontSizeDecreaseTitle(),
on: {
active: function () {
_this._selection.setTextSizeDelta(-1);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonFontSizeIncrease", {
get: function () {
var result = this._buttonFontSizeIncrease;
if (result == null) {
result = this.newButtonFontSizeIncrease();
this._buttonFontSizeIncrease = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonFontSizeIncrease = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.editor_font_size_increase
},
title: this.theme.getButtonFontSizeIncreaseTitle(),
on: {
active: function () {
_this._selection.setTextSizeDelta(+1);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonFontItalic", {
get: function () {
var result = this._buttonFontItalic;
if (result == null) {
result = this.newButtonFontItalic();
this._buttonFontItalic = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonFontItalic = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.italic
},
toggle: true,
title: this.theme.getButtonFontItalicTitle(),
on: {
active: function () {
_this._selection.setTextStyle(EShapeTextStyle.ITALIC);
},
inactive: function () {
_this._selection.setTextStyle(EShapeTextStyle.NORMAL);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonFontBold", {
get: function () {
var result = this._buttonFontBold;
if (result == null) {
result = this.newButtonFontBold();
this._buttonFontBold = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonFontBold = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.bold
},
toggle: true,
title: this.theme.getButtonFontBoldTitle(),
on: {
active: function () {
_this._selection.setTextWeight(EShapeTextWeight.BOLD);
},
inactive: function () {
_this._selection.setTextWeight(EShapeTextWeight.NORMAL);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonOutline", {
get: function () {
var result = this._buttonOutline;
if (result == null) {
result = this.newButtonOutline();
this._buttonOutline = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonOutline = function () {
var _this = this;
return new DButtonCheckRight({
width: "100%",
text: {
value: this.theme.getButtonOutlineLabel()
},
padding: 0,
background: {
color: null
},
on: {
active: function () {
_this._selection.setTextOutlineEnabled(true);
},
inactive: function () {
_this._selection.setTextOutlineEnabled(false);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonOutlineColor", {
get: function () {
var result = this._buttonOutlineColor;
if (result == null) {
result = this.newButtonOutlineColor();
this._buttonOutlineColor = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonOutlineColor = function () {
var _this = this;
var result = new DButtonColor({
width: "100%",
on: {
change: function (value) {
_this._selection.setTextOutlineColor(value.color, value.alpha);
}
}
});
result.dialog.on("open", function () {
var dialog = result.dialog;
var dialogNew = dialog.new;
var dialogCurrent = dialog.current;
dialogNew.color = dialogCurrent.color;
dialogNew.alpha = dialogCurrent.alpha;
});
return result;
};
Object.defineProperty(EEditorText.prototype, "inputOutlineWidth", {
get: function () {
var _a;
return ((_a = this._inputOutlineWidth) !== null && _a !== void 0 ? _a : (this._inputOutlineWidth = this.newInputOutlineWidth()));
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputOutlineWidth = function () {
var _this = this;
return new DInputRealAndLabel({
width: "100%",
label: {
text: {
value: this.theme.getInputOutlineWidthLabel()
}
},
input: {
weight: 1,
min: 0,
step: 1,
max: 100,
on: {
change: function (value) {
_this._selection.setTextOutlineWidth(value * 0.01);
}
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignOutsideLeft", {
get: function () {
var result = this._buttonAlignOutsideLeft;
if (result == null) {
result = this.newButtonAlignOutsideLeft();
this._buttonAlignOutsideLeft = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignOutsideLeft = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_outside_left
},
title: this.theme.getButtonAlignOutsideLeftTitle(),
on: {
active: function () {
_this._selection.setTextAlignHorizontal(EShapeTextAlignHorizontal.OUTSIDE_LEFT);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignLeft", {
get: function () {
var result = this._buttonAlignLeft;
if (result == null) {
result = this.newButtonAlignLeft();
this._buttonAlignLeft = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignLeft = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_left
},
title: this.theme.getButtonAlignLeftTitle(),
on: {
active: function () {
_this._selection.setTextAlignHorizontal(EShapeTextAlignHorizontal.LEFT);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignCenter", {
get: function () {
var result = this._buttonAlignCenter;
if (result == null) {
result = this.newButtonAlignCenter();
this._buttonAlignCenter = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignCenter = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_center
},
title: this.theme.getButtonAlignCenterTitle(),
on: {
active: function () {
_this._selection.setTextAlignHorizontal(EShapeTextAlignHorizontal.CENTER);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignRight", {
get: function () {
var result = this._buttonAlignRight;
if (result == null) {
result = this.newButtonAlignRight();
this._buttonAlignRight = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignRight = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_right
},
title: this.theme.getButtonAlignRightTitle(),
on: {
active: function () {
_this._selection.setTextAlignHorizontal(EShapeTextAlignHorizontal.RIGHT);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignOutsideRight", {
get: function () {
var result = this._buttonAlignOutsideRight;
if (result == null) {
result = this.newButtonAlignOutsideRight();
this._buttonAlignOutsideRight = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignOutsideRight = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_outside_right
},
title: this.theme.getButtonAlignOutsideRightTitle(),
on: {
active: function () {
_this._selection.setTextAlignHorizontal(EShapeTextAlignHorizontal.OUTSIDE_RIGHT);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignOutsideTop", {
get: function () {
var result = this._buttonAlignOutsideTop;
if (result == null) {
result = this.newButtonAlignOutsideTop();
this._buttonAlignOutsideTop = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignOutsideTop = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_outside_top
},
title: this.theme.getButtonAlignOutsideTopTitle(),
on: {
active: function () {
_this._selection.setTextAlignVertical(EShapeTextAlignVertical.OUTSIDE_TOP);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignTop", {
get: function () {
var result = this._buttonAlignTop;
if (result == null) {
result = this.newButtonAlignTop();
this._buttonAlignTop = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignTop = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_top
},
title: this.theme.getButtonAlignTopTitle(),
on: {
active: function () {
_this._selection.setTextAlignVertical(EShapeTextAlignVertical.TOP);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignMiddle", {
get: function () {
var result = this._buttonAlignMiddle;
if (result == null) {
result = this.newButtonAlignMiddle();
this._buttonAlignMiddle = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignMiddle = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_middle
},
title: this.theme.getButtonAlignMiddleTitle(),
on: {
active: function () {
_this._selection.setTextAlignVertical(EShapeTextAlignVertical.MIDDLE);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignBottom", {
get: function () {
var result = this._buttonAlignBottom;
if (result == null) {
result = this.newButtonAlignBottom();
this._buttonAlignBottom = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignBottom = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_bottom
},
title: this.theme.getButtonAlignBottomTitle(),
on: {
active: function () {
_this._selection.setTextAlignVertical(EShapeTextAlignVertical.BOTTOM);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonAlignOutsideBottom", {
get: function () {
var result = this._buttonAlignOutsideBottom;
if (result == null) {
result = this.newButtonAlignOutsideBottom();
this._buttonAlignOutsideBottom = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonAlignOutsideBottom = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_align_outside_bottom
},
title: this.theme.getButtonAlignOutsideBottomTitle(),
on: {
active: function () {
_this._selection.setTextAlignVertical(EShapeTextAlignVertical.OUTSIDE_BOTTOM);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonDirectionLeftToRight", {
get: function () {
var result = this._buttonDirectionLeftToRight;
if (result == null) {
result = this.newButtonDirectionLeftToRight();
this._buttonDirectionLeftToRight = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonDirectionLeftToRight = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_direction_left_to_right
},
title: this.theme.getButtonDirectionLeftToRightTitle(),
on: {
active: function () {
_this._selection.setTextDirection(EShapeTextDirection.LEFT_TO_RIGHT);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonDirectionTopToBottom", {
get: function () {
var result = this._buttonDirectionTopToBottom;
if (result == null) {
result = this.newButtonDirectionTopToBottom();
this._buttonDirectionTopToBottom = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonDirectionTopToBottom = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_direction_top_to_bottom
},
title: this.theme.getButtonDirectionTopToBottomTitle(),
on: {
active: function () {
_this._selection.setTextDirection(EShapeTextDirection.TOP_TO_BOTTOM);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonDirectionBottomToTop", {
get: function () {
var result = this._buttonDirectionBottomToTop;
if (result == null) {
result = this.newButtonDirectionBottomToTop();
this._buttonDirectionBottomToTop = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonDirectionBottomToTop = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_direction_bottom_to_top
},
title: this.theme.getButtonDirectionBottomToTopTitle(),
on: {
active: function () {
_this._selection.setTextDirection(EShapeTextDirection.BOTTOM_TO_TOP);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonDirectionRightToLeft", {
get: function () {
var result = this._buttonDirectionRightToLeft;
if (result == null) {
result = this.newButtonDirectionRightToLeft();
this._buttonDirectionRightToLeft = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonDirectionRightToLeft = function () {
var _this = this;
return new DButtonAmbient({
width: 30,
image: {
source: this._icons.text_direction_right_to_left
},
title: this.theme.getButtonDirectionRightToLeftTitle(),
on: {
active: function () {
_this._selection.setTextDirection(EShapeTextDirection.RIGHT_TO_LEFT);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonClipping", {
get: function () {
var result = this._buttonClipping;
if (result == null) {
result = this.newButtonClipping();
this._buttonClipping = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonClipping = function () {
var _this = this;
return new DButtonCheckRight({
width: "100%",
text: {
value: this.theme.getButtonClippingLabel()
},
padding: 0,
background: {
color: null
},
on: {
active: function () {
_this._selection.setTextClipping(true);
},
inactive: function () {
_this._selection.setTextClipping(false);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "buttonFitting", {
get: function () {
var result = this._buttonFitting;
if (result == null) {
result = this.newButtonFitting();
this._buttonFitting = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newButtonFitting = function () {
var _this = this;
return new DButtonCheckRight({
width: "100%",
text: {
value: this.theme.getButtonFittingLabel()
},
padding: 0,
background: {
color: null
},
on: {
active: function () {
_this._selection.setTextFitting(true);
},
inactive: function () {
_this._selection.setTextFitting(false);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "inputSpacingHorizontal", {
get: function () {
var result = this._inputSpacingHorizontal;
if (result == null) {
result = this.newInputSpacingHorizontal();
this._inputSpacingHorizontal = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputSpacingHorizontal = function () {
var _this = this;
return new DInputReal({
weight: 1,
step: 1,
text: {
value: 0
},
on: {
change: function (value) {
_this._selection.setTextSpacingHorizontal(value);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "inputSpacingVertical", {
get: function () {
var result = this._inputSpacingVertical;
if (result == null) {
result = this.newInputSpacingVertical();
this._inputSpacingVertical = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputSpacingVertical = function () {
var _this = this;
return new DInputReal({
weight: 1,
step: 1,
text: {
value: 0
},
on: {
change: function (value) {
_this._selection.setTextSpacingVertical(value);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "inputPaddingHorizontal", {
get: function () {
var result = this._inputPaddingHorizontal;
if (result == null) {
result = this.newInputPaddingHorizontal();
this._inputPaddingHorizontal = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputPaddingHorizontal = function () {
var _this = this;
return new DInputReal({
weight: 1,
step: 1,
text: {
value: 0
},
on: {
change: function (value) {
_this._selection.setTextPaddingHorizontal(value);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "inputPaddingVertical", {
get: function () {
var result = this._inputTextPaddingVertical;
if (result == null) {
result = this.newInputPaddingVertical();
this._inputTextPaddingVertical = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputPaddingVertical = function () {
var _this = this;
return new DInputReal({
weight: 1,
step: 1,
text: {
value: 0
},
on: {
change: function (value) {
_this._selection.setTextPaddingVertical(value);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "inputOffsetHorizontal", {
get: function () {
var result = this._inputOffsetHorizontal;
if (result == null) {
result = this.newInputOffsetHorizontal();
this._inputOffsetHorizontal = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputOffsetHorizontal = function () {
var _this = this;
return new DInputReal({
weight: 1,
step: 1,
text: {
value: 0
},
on: {
change: function (value) {
_this._selection.setTextOffsetHorizontal(value);
}
}
});
};
Object.defineProperty(EEditorText.prototype, "inputOffsetVertical", {
get: function () {
var result = this._inputOffsetVertical;
if (result == null) {
result = this.newInputOffsetVertical();
this._inputOffsetVertical = result;
}
return result;
},
enumerable: false,
configurable: true
});
EEditorText.prototype.newInputOffsetVertical = function () {
var _this = this;
return new DInputReal({
weight: 1,
step: 1,
text: {
value: 0
},
on: {
change: function (value) {
_this._selection.setTextOffsetVertical(value);
}
}
});
};
EEditorText.prototype.onSelectionChange = function (selection) {
var _a;
this.state.isDisabled = selection.isEmpty();
var last = selection.last();
if (last != null) {
var text = last.text;
this.inputText.value = text.value;
var textFamily = text.family;
this.dropdownFontFamily.text = (_a = this.fontFamilies.get(textFamily)) !== null && _a !== void 0 ? _a : textFamily;
var buttonFontColor = this.buttonFontColor.value;
buttonFontColor.color = text.color;
buttonFontColor.alpha = text.alpha;
this.inputFontSize.value = text.size;
this.buttonFontItalic.state.isActive = text.style === EShapeTextStyle.ITALIC;
this.buttonFontBold.state.isActive = text.weight === EShapeTextWeight.BOLD;
var outline = text.outline;
this.buttonOutline.state.isActive = outline.enable;
var buttonOutlineColor = this.buttonOutlineColor;
var buttonOutlineColorValue = buttonOutlineColor.value;
buttonOutlineColorValue.color = outline.color;
buttonOutlineColorValue.alpha = outline.alpha;
buttonOutlineColor.state.isDisabled = !outline.enable;
var inputOutlineWidth = this.inputOutlineWidth;
inputOutlineWidth.input.value = outline.width * 100;
inputOutlineWidth.state.isDisabled = !outline.enable;
this.buttonClipping.state.isActive = text.clipping;
this.buttonFitting.state.isActive = text.fitting;
var spacing = text.spacing;
this.inputSpacingHorizontal.value = spacing.horizontal;
this.inputSpacingVertical.value = spacing.vertical;
var padding = text.padding;
this.inputPaddingHorizontal.value = padding.horizontal;
this.inputPaddingVertical.value = padding.vertical;
var offset = text.offset;
this.inputOffsetHorizontal.value = offset.horizontal;
this.inputOffsetVertical.value = offset.vertical;
}
};
EEditorText.prototype.getType = function () {
return "EEditorText";
};
return EEditorText;
}(DPane));
export { EEditorText };
//# sourceMappingURL=e-editor-text.js.map