@babylonjs/gui-editor 5.45.1 → 5.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36574,11 +36574,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
36574
36574
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
36575
36575
|
const Null_Value = Number.MAX_SAFE_INTEGER;
|
36576
36576
|
class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
36577
|
-
constructor(props) {
|
36578
|
-
super(props);
|
36579
|
-
this._localChange = false;
|
36580
|
-
this.state = { value: this._remapValueIn(this._getValue(props)) };
|
36581
|
-
}
|
36582
36577
|
_remapValueIn(value) {
|
36583
36578
|
return this.props.allowNullValue && value === null ? Null_Value : value;
|
36584
36579
|
}
|
@@ -36591,6 +36586,11 @@ class OptionsLineComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component
|
|
36591
36586
|
}
|
36592
36587
|
return props.target && props.propertyName ? props.target[props.propertyName] : props.options[props.defaultIfNull || 0];
|
36593
36588
|
}
|
36589
|
+
constructor(props) {
|
36590
|
+
super(props);
|
36591
|
+
this._localChange = false;
|
36592
|
+
this.state = { value: this._remapValueIn(this._getValue(props)) };
|
36593
|
+
}
|
36594
36594
|
shouldComponentUpdate(nextProps, nextState) {
|
36595
36595
|
if (this._localChange) {
|
36596
36596
|
this._localChange = false;
|
@@ -41972,6 +41972,72 @@ const ARROW_KEY_MOVEMENT_LARGE = 5; // px
|
|
41972
41972
|
const MAX_POINTER_TRAVEL_DISTANCE = 5; //px^2. determines how far the pointer can move to be treated as a drag vs. a click
|
41973
41973
|
const CONTROL_OFFSET = 10; //offset in pixels for when a control is added to editor
|
41974
41974
|
class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
41975
|
+
static get addedFonts() {
|
41976
|
+
return this._addedFonts;
|
41977
|
+
}
|
41978
|
+
get visibleRegionContainer() {
|
41979
|
+
return this._visibleRegionContainer;
|
41980
|
+
}
|
41981
|
+
get panAndZoomContainer() {
|
41982
|
+
return this._panAndZoomContainer;
|
41983
|
+
}
|
41984
|
+
set trueRootContainer(value) {
|
41985
|
+
if (value === this._trueRootContainer)
|
41986
|
+
return;
|
41987
|
+
this._visibleRegionContainer.children.forEach((child) => this._visibleRegionContainer.removeControl(child));
|
41988
|
+
this._visibleRegionContainer.addControl(value);
|
41989
|
+
this._trueRootContainer = value;
|
41990
|
+
value._host = this.props.globalState.guiTexture;
|
41991
|
+
}
|
41992
|
+
get trueRootContainer() {
|
41993
|
+
return this._trueRootContainer;
|
41994
|
+
}
|
41995
|
+
get guiSize() {
|
41996
|
+
return this._guiSize;
|
41997
|
+
}
|
41998
|
+
get pasteDisabled() {
|
41999
|
+
return this._pasteDisabled;
|
42000
|
+
}
|
42001
|
+
// sets the size of the GUI and makes all necessary adjustments
|
42002
|
+
set guiSize(value) {
|
42003
|
+
this._guiSize = { ...value };
|
42004
|
+
this._visibleRegionContainer.widthInPixels = this._guiSize.width;
|
42005
|
+
this._visibleRegionContainer.heightInPixels = this._guiSize.height;
|
42006
|
+
this.props.globalState.onResizeObservable.notifyObservers(this._guiSize);
|
42007
|
+
this.props.globalState.onReframeWindowObservable.notifyObservers();
|
42008
|
+
this.props.globalState.onWindowResizeObservable.notifyObservers();
|
42009
|
+
}
|
42010
|
+
applyEditorTransformation() {
|
42011
|
+
const adt = this.props.globalState.guiTexture;
|
42012
|
+
if (adt._rootContainer != this._panAndZoomContainer) {
|
42013
|
+
adt._rootContainer = this._panAndZoomContainer;
|
42014
|
+
this._visibleRegionContainer.addControl(this._trueRootContainer);
|
42015
|
+
this.props.globalState.guiTexture.markAsDirty();
|
42016
|
+
}
|
42017
|
+
if (adt.getSize().width !== this._engine.getRenderWidth() || adt.getSize().height !== this._engine.getRenderHeight()) {
|
42018
|
+
adt.scaleTo(this._engine.getRenderWidth(), this._engine.getRenderHeight());
|
42019
|
+
}
|
42020
|
+
if (adt.getSize().width !== this._engine.getRenderWidth() || adt.getSize().height !== this._engine.getRenderHeight()) {
|
42021
|
+
adt.scaleTo(this._engine.getRenderWidth(), this._engine.getRenderHeight());
|
42022
|
+
}
|
42023
|
+
this._trueRootContainer.clipContent = false;
|
42024
|
+
this._trueRootContainer.clipChildren = false;
|
42025
|
+
}
|
42026
|
+
removeEditorTransformation() {
|
42027
|
+
const adt = this.props.globalState.guiTexture;
|
42028
|
+
if (adt._rootContainer != this._trueRootContainer) {
|
42029
|
+
this._visibleRegionContainer.removeControl(this._trueRootContainer);
|
42030
|
+
adt._rootContainer = this._trueRootContainer;
|
42031
|
+
}
|
42032
|
+
this._trueRootContainer.clipContent = true;
|
42033
|
+
this._trueRootContainer.clipChildren = true;
|
42034
|
+
}
|
42035
|
+
_reframeWindow() {
|
42036
|
+
this._panningOffset = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(0, 0);
|
42037
|
+
const xFactor = this._engine.getRenderWidth() / this.guiSize.width;
|
42038
|
+
const yFactor = this._engine.getRenderHeight() / this.guiSize.height;
|
42039
|
+
this._zoomFactor = Math.min(xFactor, yFactor) * 0.9;
|
42040
|
+
}
|
41975
42041
|
constructor(props) {
|
41976
42042
|
super(props);
|
41977
42043
|
this._setConstraintDirection = false;
|
@@ -42106,72 +42172,6 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
|
42106
42172
|
this.dispose();
|
42107
42173
|
});
|
42108
42174
|
}
|
42109
|
-
static get addedFonts() {
|
42110
|
-
return this._addedFonts;
|
42111
|
-
}
|
42112
|
-
get visibleRegionContainer() {
|
42113
|
-
return this._visibleRegionContainer;
|
42114
|
-
}
|
42115
|
-
get panAndZoomContainer() {
|
42116
|
-
return this._panAndZoomContainer;
|
42117
|
-
}
|
42118
|
-
set trueRootContainer(value) {
|
42119
|
-
if (value === this._trueRootContainer)
|
42120
|
-
return;
|
42121
|
-
this._visibleRegionContainer.children.forEach((child) => this._visibleRegionContainer.removeControl(child));
|
42122
|
-
this._visibleRegionContainer.addControl(value);
|
42123
|
-
this._trueRootContainer = value;
|
42124
|
-
value._host = this.props.globalState.guiTexture;
|
42125
|
-
}
|
42126
|
-
get trueRootContainer() {
|
42127
|
-
return this._trueRootContainer;
|
42128
|
-
}
|
42129
|
-
get guiSize() {
|
42130
|
-
return this._guiSize;
|
42131
|
-
}
|
42132
|
-
get pasteDisabled() {
|
42133
|
-
return this._pasteDisabled;
|
42134
|
-
}
|
42135
|
-
// sets the size of the GUI and makes all necessary adjustments
|
42136
|
-
set guiSize(value) {
|
42137
|
-
this._guiSize = { ...value };
|
42138
|
-
this._visibleRegionContainer.widthInPixels = this._guiSize.width;
|
42139
|
-
this._visibleRegionContainer.heightInPixels = this._guiSize.height;
|
42140
|
-
this.props.globalState.onResizeObservable.notifyObservers(this._guiSize);
|
42141
|
-
this.props.globalState.onReframeWindowObservable.notifyObservers();
|
42142
|
-
this.props.globalState.onWindowResizeObservable.notifyObservers();
|
42143
|
-
}
|
42144
|
-
applyEditorTransformation() {
|
42145
|
-
const adt = this.props.globalState.guiTexture;
|
42146
|
-
if (adt._rootContainer != this._panAndZoomContainer) {
|
42147
|
-
adt._rootContainer = this._panAndZoomContainer;
|
42148
|
-
this._visibleRegionContainer.addControl(this._trueRootContainer);
|
42149
|
-
this.props.globalState.guiTexture.markAsDirty();
|
42150
|
-
}
|
42151
|
-
if (adt.getSize().width !== this._engine.getRenderWidth() || adt.getSize().height !== this._engine.getRenderHeight()) {
|
42152
|
-
adt.scaleTo(this._engine.getRenderWidth(), this._engine.getRenderHeight());
|
42153
|
-
}
|
42154
|
-
if (adt.getSize().width !== this._engine.getRenderWidth() || adt.getSize().height !== this._engine.getRenderHeight()) {
|
42155
|
-
adt.scaleTo(this._engine.getRenderWidth(), this._engine.getRenderHeight());
|
42156
|
-
}
|
42157
|
-
this._trueRootContainer.clipContent = false;
|
42158
|
-
this._trueRootContainer.clipChildren = false;
|
42159
|
-
}
|
42160
|
-
removeEditorTransformation() {
|
42161
|
-
const adt = this.props.globalState.guiTexture;
|
42162
|
-
if (adt._rootContainer != this._trueRootContainer) {
|
42163
|
-
this._visibleRegionContainer.removeControl(this._trueRootContainer);
|
42164
|
-
adt._rootContainer = this._trueRootContainer;
|
42165
|
-
}
|
42166
|
-
this._trueRootContainer.clipContent = true;
|
42167
|
-
this._trueRootContainer.clipChildren = true;
|
42168
|
-
}
|
42169
|
-
_reframeWindow() {
|
42170
|
-
this._panningOffset = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(0, 0);
|
42171
|
-
const xFactor = this._engine.getRenderWidth() / this.guiSize.width;
|
42172
|
-
const yFactor = this._engine.getRenderHeight() / this.guiSize.height;
|
42173
|
-
this._zoomFactor = Math.min(xFactor, yFactor) * 0.9;
|
42174
|
-
}
|
42175
42175
|
copyToClipboard(copyFn) {
|
42176
42176
|
this._pasteDisabled = false;
|
42177
42177
|
const controlList = [];
|
@@ -42950,6 +42950,36 @@ var GUIEditorTool;
|
|
42950
42950
|
GUIEditorTool[GUIEditorTool["ZOOM"] = 2] = "ZOOM";
|
42951
42951
|
})(GUIEditorTool || (GUIEditorTool = {}));
|
42952
42952
|
class GlobalState {
|
42953
|
+
get tool() {
|
42954
|
+
if (this._tool === GUIEditorTool.ZOOM) {
|
42955
|
+
return GUIEditorTool.ZOOM;
|
42956
|
+
}
|
42957
|
+
else if (this._tool === GUIEditorTool.PAN) {
|
42958
|
+
return GUIEditorTool.PAN;
|
42959
|
+
}
|
42960
|
+
else {
|
42961
|
+
return GUIEditorTool.SELECT;
|
42962
|
+
}
|
42963
|
+
}
|
42964
|
+
set tool(newTool) {
|
42965
|
+
if (this._tool === newTool)
|
42966
|
+
return;
|
42967
|
+
this._prevTool = this._tool;
|
42968
|
+
this._tool = newTool;
|
42969
|
+
this.onToolChangeObservable.notifyObservers();
|
42970
|
+
}
|
42971
|
+
get usePrevSelected() {
|
42972
|
+
return this._usePrevSelected;
|
42973
|
+
}
|
42974
|
+
set usePrevSelected(val) {
|
42975
|
+
this._usePrevSelected = val;
|
42976
|
+
}
|
42977
|
+
restorePreviousTool() {
|
42978
|
+
if (this._tool !== this._prevTool) {
|
42979
|
+
this._tool = this._prevTool;
|
42980
|
+
this.onToolChangeObservable.notifyObservers();
|
42981
|
+
}
|
42982
|
+
}
|
42953
42983
|
constructor() {
|
42954
42984
|
this.selectedControls = [];
|
42955
42985
|
this.onSelectionChangedObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable();
|
@@ -43007,36 +43037,6 @@ class GlobalState {
|
|
43007
43037
|
this.onBackgroundColorChangeObservable.notifyObservers();
|
43008
43038
|
_diagram_coordinateHelper__WEBPACK_IMPORTED_MODULE_2__.CoordinateHelper.GlobalState = this;
|
43009
43039
|
}
|
43010
|
-
get tool() {
|
43011
|
-
if (this._tool === GUIEditorTool.ZOOM) {
|
43012
|
-
return GUIEditorTool.ZOOM;
|
43013
|
-
}
|
43014
|
-
else if (this._tool === GUIEditorTool.PAN) {
|
43015
|
-
return GUIEditorTool.PAN;
|
43016
|
-
}
|
43017
|
-
else {
|
43018
|
-
return GUIEditorTool.SELECT;
|
43019
|
-
}
|
43020
|
-
}
|
43021
|
-
set tool(newTool) {
|
43022
|
-
if (this._tool === newTool)
|
43023
|
-
return;
|
43024
|
-
this._prevTool = this._tool;
|
43025
|
-
this._tool = newTool;
|
43026
|
-
this.onToolChangeObservable.notifyObservers();
|
43027
|
-
}
|
43028
|
-
get usePrevSelected() {
|
43029
|
-
return this._usePrevSelected;
|
43030
|
-
}
|
43031
|
-
set usePrevSelected(val) {
|
43032
|
-
this._usePrevSelected = val;
|
43033
|
-
}
|
43034
|
-
restorePreviousTool() {
|
43035
|
-
if (this._tool !== this._prevTool) {
|
43036
|
-
this._tool = this._prevTool;
|
43037
|
-
this.onToolChangeObservable.notifyObservers();
|
43038
|
-
}
|
43039
|
-
}
|
43040
43040
|
/** adds copy, cut and paste listeners to the host window */
|
43041
43041
|
registerEventListeners() {
|
43042
43042
|
const isElementEditable = (element) => {
|
@@ -43735,6 +43735,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
43735
43735
|
|
43736
43736
|
|
43737
43737
|
class WorkbenchEditor extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
43738
|
+
componentDidMount() {
|
43739
|
+
if (navigator.userAgent.indexOf("Mobile") !== -1) {
|
43740
|
+
(this.props.globalState.hostDocument || document).querySelector(".blocker").style.visibility = "visible";
|
43741
|
+
}
|
43742
|
+
document.addEventListener("keydown", this.addToolControls);
|
43743
|
+
document.addEventListener("keyup", this.removePressToolControls);
|
43744
|
+
}
|
43745
|
+
componentWillUnmount() {
|
43746
|
+
document.removeEventListener("keydown", this.addToolControls);
|
43747
|
+
document.removeEventListener("keyup", this.removePressToolControls);
|
43748
|
+
if (this._onErrorMessageObserver) {
|
43749
|
+
this.props.globalState.onErrorMessageDialogRequiredObservable.remove(this._onErrorMessageObserver);
|
43750
|
+
}
|
43751
|
+
}
|
43738
43752
|
constructor(props) {
|
43739
43753
|
super(props);
|
43740
43754
|
this._leftWidth = core_Misc_dataStorage__WEBPACK_IMPORTED_MODULE_6__.DataStorage.ReadNumber("LeftWidth", 200);
|
@@ -43863,20 +43877,6 @@ class WorkbenchEditor extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
|
43863
43877
|
this.setState({ message });
|
43864
43878
|
});
|
43865
43879
|
}
|
43866
|
-
componentDidMount() {
|
43867
|
-
if (navigator.userAgent.indexOf("Mobile") !== -1) {
|
43868
|
-
(this.props.globalState.hostDocument || document).querySelector(".blocker").style.visibility = "visible";
|
43869
|
-
}
|
43870
|
-
document.addEventListener("keydown", this.addToolControls);
|
43871
|
-
document.addEventListener("keyup", this.removePressToolControls);
|
43872
|
-
}
|
43873
|
-
componentWillUnmount() {
|
43874
|
-
document.removeEventListener("keydown", this.addToolControls);
|
43875
|
-
document.removeEventListener("keyup", this.removePressToolControls);
|
43876
|
-
if (this._onErrorMessageObserver) {
|
43877
|
-
this.props.globalState.onErrorMessageDialogRequiredObservable.remove(this._onErrorMessageObserver);
|
43878
|
-
}
|
43879
|
-
}
|
43880
43880
|
showWaitScreen() {
|
43881
43881
|
this.props.globalState.hostDocument.querySelector(".wait-screen")?.classList.remove("hidden");
|
43882
43882
|
}
|