@babylonjs/gui-editor 5.38.0 → 5.40.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.
@@ -40217,7 +40217,7 @@ class SceneExplorerComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Componen
40217
40217
  if (!scene) {
40218
40218
  return null;
40219
40219
  }
40220
- const guiElements = scene.textures.filter((t) => t.getClassName() === "AdvancedDynamicTexture");
40220
+ const guiElements = [this.props.globalState.guiTexture];
40221
40221
  return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div", { id: "tree", onDrop: () => {
40222
40222
  this.props.globalState.onDropObservable.notifyObservers();
40223
40223
  this.props.globalState.onParentingChangeObservable.notifyObservers(null);
@@ -41118,7 +41118,7 @@ __webpack_require__.r(__webpack_exports__);
41118
41118
  /* harmony export */ "GizmoGeneric": () => (/* binding */ GizmoGeneric)
41119
41119
  /* harmony export */ });
41120
41120
  /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "../../../../node_modules/react/jsx-runtime.js");
41121
- /* harmony import */ var gui_2D_controls_control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! gui/2D/valueAndUnit */ "gui/2D/controls/container");
41121
+ /* harmony import */ var gui_2D_controls_control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! gui/2D/math2D */ "gui/2D/controls/container");
41122
41122
  /* harmony import */ var gui_2D_controls_control__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(gui_2D_controls_control__WEBPACK_IMPORTED_MODULE_1__);
41123
41123
  /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core/Maths/math.vector */ "core/Misc/observable");
41124
41124
  /* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_2__);
@@ -41132,6 +41132,7 @@ __webpack_require__.r(__webpack_exports__);
41132
41132
 
41133
41133
 
41134
41134
 
41135
+
41135
41136
  const roundFactor = 100;
41136
41137
  const round = (value) => Math.round(value * roundFactor) / roundFactor;
41137
41138
  const modulo = (dividend, divisor) => ((dividend % divisor) + divisor) % divisor;
@@ -41161,9 +41162,8 @@ class GizmoGeneric extends react__WEBPACK_IMPORTED_MODULE_3__.Component {
41161
41162
  const node = this.props.control;
41162
41163
  const inRTT = _coordinateHelper__WEBPACK_IMPORTED_MODULE_4__.CoordinateHelper.MousePointerToRTTSpace(node, scene.pointerX, scene.pointerY);
41163
41164
  const inNodeSpace = _coordinateHelper__WEBPACK_IMPORTED_MODULE_4__.CoordinateHelper.RttToLocalNodeSpace(node, inRTT.x, inRTT.y, undefined, this._storedValues);
41164
- this._dragLocalBounds(inNodeSpace);
41165
+ this._dragLocalBounds(inNodeSpace, this.props.globalState.shiftKeyPressed);
41165
41166
  this._updateNodeFromLocalBounds();
41166
- this.props.globalState.workbench._liveGuiTextureRerender = false;
41167
41167
  this.props.globalState.onPropertyGridUpdateRequiredObservable.notifyObservers();
41168
41168
  }
41169
41169
  if (this.state.isRotating) {
@@ -41324,13 +41324,14 @@ class GizmoGeneric extends react__WEBPACK_IMPORTED_MODULE_3__.Component {
41324
41324
  y: (x - centerX) * Math.sin(angle) + (y - centerY) * Math.cos(angle) + centerY,
41325
41325
  };
41326
41326
  }
41327
- _dragLocalBounds(toPosition) {
41327
+ _dragLocalBounds(toPosition, preserveAspectRatio = false) {
41328
41328
  const scalePoint = this.state.scalePoints[this.state.scalePointDragging];
41329
41329
  const newBounds = this._localBounds.clone();
41330
+ const currentAspectRatio = gui_2D_controls_control__WEBPACK_IMPORTED_MODULE_1__.MathTools.Round(this._localBounds.width / this._localBounds.height);
41330
41331
  if (scalePoint.horizontalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Left) {
41331
41332
  newBounds.left = Math.min(this._localBounds.right - 1, toPosition.x);
41332
41333
  }
41333
- if (scalePoint.verticalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Left) {
41334
+ if (scalePoint.verticalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Top) {
41334
41335
  newBounds.top = Math.min(this._localBounds.bottom - 1, toPosition.y);
41335
41336
  }
41336
41337
  if (scalePoint.horizontalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Right) {
@@ -41339,6 +41340,38 @@ class GizmoGeneric extends react__WEBPACK_IMPORTED_MODULE_3__.Component {
41339
41340
  if (scalePoint.verticalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Bottom) {
41340
41341
  newBounds.bottom = Math.max(this._localBounds.top + 1, toPosition.y);
41341
41342
  }
41343
+ if (preserveAspectRatio) {
41344
+ const deltaWidth = newBounds.width - this._localBounds.width;
41345
+ const deltaHeight = newBounds.height - this._localBounds.height;
41346
+ const signInverted = scalePoint.horizontalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Center || scalePoint.verticalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Center;
41347
+ const comparison = Math.abs(deltaWidth) > Math.abs(deltaHeight);
41348
+ if (signInverted ? comparison : !comparison) {
41349
+ const aspectRatioDeltaHeight = deltaWidth / currentAspectRatio;
41350
+ if (scalePoint.verticalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Top) {
41351
+ newBounds.top = this._localBounds.top - aspectRatioDeltaHeight;
41352
+ }
41353
+ else if (scalePoint.verticalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Bottom) {
41354
+ newBounds.bottom = this._localBounds.bottom + aspectRatioDeltaHeight;
41355
+ }
41356
+ else {
41357
+ newBounds.top = this._localBounds.top - aspectRatioDeltaHeight / 2;
41358
+ newBounds.bottom = this._localBounds.bottom + aspectRatioDeltaHeight / 2;
41359
+ }
41360
+ }
41361
+ else {
41362
+ const aspectRatioDeltaWidth = deltaHeight * currentAspectRatio;
41363
+ if (scalePoint.horizontalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Left) {
41364
+ newBounds.left = this._localBounds.left - aspectRatioDeltaWidth;
41365
+ }
41366
+ else if (scalePoint.horizontalPosition === _gizmoScalePoint__WEBPACK_IMPORTED_MODULE_5__.ScalePointPosition.Right) {
41367
+ newBounds.right = this._localBounds.right + aspectRatioDeltaWidth;
41368
+ }
41369
+ else {
41370
+ newBounds.left = this._localBounds.left - aspectRatioDeltaWidth / 2;
41371
+ newBounds.right = this._localBounds.right + aspectRatioDeltaWidth / 2;
41372
+ }
41373
+ }
41374
+ }
41342
41375
  // apply bounds changes to all controls
41343
41376
  const edges = ["left", "top", "right", "bottom"];
41344
41377
  for (const node of this.props.globalState.selectedControls) {
@@ -41717,6 +41750,7 @@ __webpack_require__.r(__webpack_exports__);
41717
41750
 
41718
41751
 
41719
41752
 
41753
+
41720
41754
 
41721
41755
 
41722
41756
  var ConstraintDirection;
@@ -41725,6 +41759,23 @@ var ConstraintDirection;
41725
41759
  ConstraintDirection[ConstraintDirection["X"] = 2] = "X";
41726
41760
  ConstraintDirection[ConstraintDirection["Y"] = 3] = "Y";
41727
41761
  })(ConstraintDirection || (ConstraintDirection = {}));
41762
+ /**
41763
+ * This function will throttle calls to functions.
41764
+ *
41765
+ * @param callback callback to call.
41766
+ * @param time time to wait between calls in ms.
41767
+ */
41768
+ function throttle(callback, time) {
41769
+ let lastCalledTime = 0;
41770
+ return function (...args) {
41771
+ const now = Date.now();
41772
+ if (now - lastCalledTime < time) {
41773
+ return;
41774
+ }
41775
+ lastCalledTime = now;
41776
+ callback(...args);
41777
+ };
41778
+ }
41728
41779
  const ARROW_KEY_MOVEMENT_SMALL = 1; // px
41729
41780
  const ARROW_KEY_MOVEMENT_LARGE = 5; // px
41730
41781
  const MAX_POINTER_TRAVEL_DISTANCE = 5; //px^2. determines how far the pointer can move to be treated as a drag vs. a click
@@ -41737,14 +41788,11 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
41737
41788
  this._constraintDirection = ConstraintDirection.NONE;
41738
41789
  this._isOverGUINode = [];
41739
41790
  this._doubleClick = null;
41740
- this._liveGuiTextureRerender = true;
41741
41791
  this._currLeft = 0;
41742
41792
  this._currTop = 0;
41743
41793
  this._controlsHit = [];
41744
41794
  this._pointerTravelDistance = 0;
41745
41795
  this._processSelectionOnUp = false;
41746
- this._nextLiveGuiRender = -1;
41747
- this._liveGuiRerenderDelay = 30;
41748
41796
  this._defaultGUISize = { width: 1024, height: 1024 };
41749
41797
  this._initialPanningOffset = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(0, 0);
41750
41798
  this._panningOffset = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(0, 0);
@@ -41762,6 +41810,7 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
41762
41810
  this._setConstraintDirection = false;
41763
41811
  this._constraintDirection = ConstraintDirection.NONE;
41764
41812
  }
41813
+ this.props.globalState.shiftKeyPressed = evt.shiftKey && evt.type === "keydown";
41765
41814
  if (evt.key === "Delete" || evt.key === "Backspace") {
41766
41815
  if (!this.props.globalState.lockObject.lock) {
41767
41816
  this.props.globalState.deleteSelectedNodes();
@@ -42004,16 +42053,6 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42004
42053
  * @param guiControl
42005
42054
  */
42006
42055
  addEditorBehavior(guiControl) {
42007
- const onPointerUpStored = guiControl.onPointerUpObservable.observers.slice();
42008
- guiControl.onPointerUpObservable.clear();
42009
- const onPointerDownStored = guiControl.onPointerDownObservable.observers.slice();
42010
- guiControl.onPointerDownObservable.clear();
42011
- const onPointerEnterStored = guiControl.onPointerEnterObservable.observers.slice();
42012
- guiControl.onPointerEnterObservable.clear();
42013
- const onPointerOutStored = guiControl.onPointerOutObservable.observers.slice();
42014
- guiControl.onPointerOutObservable.clear();
42015
- const onDisposeStored = guiControl.onDisposeObservable.observers.slice();
42016
- guiControl.onDisposeObservable.clear();
42017
42056
  guiControl.onPointerUpObservable.add(() => {
42018
42057
  this.clicked = false;
42019
42058
  });
@@ -42039,21 +42078,9 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42039
42078
  this._isOverGUINode.splice(index, 1);
42040
42079
  }
42041
42080
  });
42042
- // use metadata to keep track of things we need to cleanup/restore when the gui editor closes
42043
- // also stores the old metadata
42044
42081
  guiControl.metadata = {
42082
+ ...guiControl.metadata,
42045
42083
  guiEditor: true,
42046
- metadata: guiControl.metadata,
42047
- isHighlighted: guiControl.isHighlighted,
42048
- highlightLineWidth: guiControl.highlightLineWidth,
42049
- isReadOnly: guiControl.isReadOnly,
42050
- isHitTestVisible: guiControl.isHitTestVisible,
42051
- isPointerBlocker: guiControl.isPointerBlocker,
42052
- onPointerUpStored,
42053
- onPointerDownStored,
42054
- onPointerEnterStored,
42055
- onPointerOutStored,
42056
- onDisposeStored,
42057
42084
  };
42058
42085
  guiControl.highlightLineWidth = 5;
42059
42086
  guiControl.isHighlighted = false;
@@ -42069,44 +42096,15 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42069
42096
  if (!control.metadata || !control.metadata.guiEditor) {
42070
42097
  return;
42071
42098
  }
42072
- const restoreObservers = (observable, storedObservers) => {
42073
- observable.clear();
42074
- for (const observer of storedObservers) {
42075
- const obs = observer;
42076
- observable.add(obs.callback, obs.mask, false, obs.scope, obs.unregisterOnNextCall);
42077
- }
42078
- };
42079
- restoreObservers(control.onPointerUpObservable, control.metadata.onPointerUpStored);
42080
- restoreObservers(control.onPointerDownObservable, control.metadata.onPointerDownStored);
42081
- restoreObservers(control.onPointerEnterObservable, control.metadata.onPointerEnterStored);
42082
- restoreObservers(control.onPointerOutObservable, control.metadata.onPointerOutStored);
42083
- restoreObservers(control.onDisposeObservable, control.metadata.onDisposeStored);
42084
- control.highlightLineWidth = control.metadata.highlightLineWidth;
42085
- control.isHighlighted = control.metadata.isHighlighted;
42086
- control.isPointerBlocker = control.metadata.isPointerBlocker;
42087
- control.isHitTestVisible = control.metadata.isHitTestVisible;
42088
- control.isReadOnly = control.metadata.isReadOnly;
42089
- control.metadata = control.metadata.metadata;
42099
+ delete control.metadata.guiEditor;
42100
+ delete control.metadata.editorUniqueId;
42090
42101
  }
42091
42102
  dispose() {
42092
42103
  this.props.globalState.hostDocument.removeEventListener("keyup", this.keyEvent);
42093
42104
  this.props.globalState.hostDocument.removeEventListener("keydown", this.keyEvent);
42094
42105
  this.props.globalState.hostDocument.defaultView.removeEventListener("blur", this.blurEvent);
42095
- if (this.props.globalState.liveGuiTexture) {
42096
- this.props.globalState.liveGuiTexture.onEndRenderObservable.remove(this._liveRenderObserver);
42097
- this.props.globalState.guiTexture.onBeginRenderObservable.remove(this._guiRenderObserver);
42098
- this.props.globalState.guiTexture.getDescendants().forEach((control) => {
42099
- this.removeEditorBehavior(control);
42100
- this.props.globalState.guiTexture.removeControl(control);
42101
- if (control.parent === this._trueRootContainer) {
42102
- control.parent = this.props.globalState.liveGuiTexture.rootContainer;
42103
- }
42104
- control._host = this.props.globalState.liveGuiTexture;
42105
- });
42106
- this.props.globalState.liveGuiTexture.markAsDirty();
42107
- this.props.globalState.guiTexture.getDescendants(true).forEach((control) => {
42108
- this.props.globalState.guiTexture.removeControl(control);
42109
- });
42106
+ if (this._guiRenderObserver) {
42107
+ this.props.globalState.guiTexture.onEndRenderObservable.remove(this._guiRenderObserver);
42110
42108
  }
42111
42109
  this._engine.dispose();
42112
42110
  }
@@ -42163,9 +42161,6 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42163
42161
  }
42164
42162
  }
42165
42163
  appendBlock(guiElement) {
42166
- if (this.props.globalState.liveGuiTexture) {
42167
- this.props.globalState.liveGuiTexture.addControl(guiElement);
42168
- }
42169
42164
  this.addEditorBehavior(guiElement);
42170
42165
  guiElement.getDescendants(true).forEach((desc) => this.addEditorBehavior(desc));
42171
42166
  if (this.props.globalState.selectedControls.length != 0) {
@@ -42187,12 +42182,6 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42187
42182
  if (dropLocationControl instanceof gui_2D_controls_control__WEBPACK_IMPORTED_MODULE_3__.Container && //dropping inside a container control
42188
42183
  this.props.globalState.draggedControlDirection === _globalState__WEBPACK_IMPORTED_MODULE_2__.DragOverLocation.CENTER) {
42189
42184
  draggedControlParent.removeControl(draggedControl);
42190
- const liveGui = this.props.globalState.liveGuiTexture;
42191
- if (liveGui) {
42192
- if (liveGui.rootContainer.children.indexOf(draggedControl) !== -1) {
42193
- liveGui.rootContainer.removeControl(draggedControl);
42194
- }
42195
- }
42196
42185
  dropLocationControl.addControl(draggedControl);
42197
42186
  }
42198
42187
  else if (dropLocationControl.parent) {
@@ -42247,7 +42236,36 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42247
42236
  }
42248
42237
  }
42249
42238
  this.props.globalState.draggedControl = null;
42250
- this.props.globalState.onPropertyGridUpdateRequiredObservable.notifyObservers();
42239
+ }
42240
+ _canClone() {
42241
+ return this.props.globalState.liveGuiTexture && this.props.globalState.guiTexture && this.trueRootContainer;
42242
+ }
42243
+ _copyEditorGUIToLiveGUI() {
42244
+ if (this._canClone()) {
42245
+ // Before cloning, save all of the live GUI controls that have a linked mesh
42246
+ const controlToLinkedMesh = new Map();
42247
+ const liveRoot = this.props.globalState.liveGuiTexture.rootContainer;
42248
+ liveRoot.getDescendants().forEach((control) => {
42249
+ if (control.linkedMesh) {
42250
+ controlToLinkedMesh.set(control.metadata.editorUniqueId, control.linkedMesh);
42251
+ }
42252
+ });
42253
+ liveRoot.clearControls();
42254
+ const updatedRootChildren = this.trueRootContainer.children.slice(0);
42255
+ for (const child of updatedRootChildren) {
42256
+ const clone = child.clone(this.props.globalState.liveGuiTexture);
42257
+ liveRoot.addControl(clone);
42258
+ }
42259
+ // Relink all meshes
42260
+ liveRoot.getDescendants().forEach((control) => {
42261
+ if (control.metadata && controlToLinkedMesh.has(control.metadata.editorUniqueId)) {
42262
+ const linkedMesh = controlToLinkedMesh.get(control.metadata.editorUniqueId);
42263
+ if (linkedMesh) {
42264
+ control.linkWithMesh(linkedMesh);
42265
+ }
42266
+ }
42267
+ });
42268
+ }
42251
42269
  }
42252
42270
  _reorderGrid(grid, draggedControl, dropLocationControl) {
42253
42271
  const cellInfo = _tools__WEBPACK_IMPORTED_MODULE_5__.Tools.GetCellInfo(grid, draggedControl);
@@ -42443,6 +42461,19 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42443
42461
  this._processSelectionOnUp = false;
42444
42462
  }
42445
42463
  }
42464
+ _copyLiveGUIToEditorGUI() {
42465
+ if (this.props.globalState.liveGuiTexture && this.trueRootContainer) {
42466
+ // Create special IDs that will allow us to know which cloned control corresponds to its original
42467
+ this.props.globalState.liveGuiTexture.rootContainer.getDescendants().forEach((control) => {
42468
+ control.metadata = { ...(control.metadata ?? {}), editorUniqueId: (0,core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.RandomGUID)() };
42469
+ });
42470
+ this.trueRootContainer.clearControls();
42471
+ for (const control of this.props.globalState.liveGuiTexture.rootContainer.children) {
42472
+ const cloned = control.clone(this.props.globalState.guiTexture);
42473
+ this.appendBlock(cloned);
42474
+ }
42475
+ }
42476
+ }
42446
42477
  createGUICanvas(embed) {
42447
42478
  // Get the canvas element from the DOM.
42448
42479
  const canvas = this._rootContainer.current;
@@ -42453,10 +42484,15 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42453
42484
  this._scene.clearColor = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Color4(0, 0, 0, 0);
42454
42485
  const light = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.HemisphericLight("light1", core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Axis.Y, this._scene);
42455
42486
  light.intensity = 0.9;
42456
- if (embed) {
42457
- this.props.globalState.fromPG = true;
42458
- this._guiSize.width = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.DataStorage.ReadNumber("width", 1024);
42459
- this._guiSize.height = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.DataStorage.ReadNumber("height", 1024);
42487
+ if (this.props.globalState.liveGuiTexture) {
42488
+ this._guiSize.width = this.props.globalState.liveGuiTexture.getSize().width;
42489
+ this._guiSize.height = this.props.globalState.liveGuiTexture.getSize().height;
42490
+ canvas.width = this._guiSize.width;
42491
+ canvas.height = this._guiSize.height;
42492
+ }
42493
+ else {
42494
+ this._guiSize.width = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.DataStorage.ReadNumber("GUIEditorWidth", 1024);
42495
+ this._guiSize.height = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.DataStorage.ReadNumber("GUIEditorHeight", 1024);
42460
42496
  }
42461
42497
  this._panAndZoomContainer = new gui_2D_controls_control__WEBPACK_IMPORTED_MODULE_3__.Container("panAndZoom");
42462
42498
  this._panAndZoomContainer.clipContent = false;
@@ -42474,7 +42510,7 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42474
42510
  adt.useInvalidateRectOptimization = false;
42475
42511
  this.trueRootContainer = adt.rootContainer;
42476
42512
  adt.onEndRenderObservable.add(() => this.props.globalState.onGizmoUpdateRequireObservable.notifyObservers());
42477
- this.synchronizeLiveGUI();
42513
+ this._copyLiveGUIToEditorGUI();
42478
42514
  new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.ArcRotateCamera("Camera", 0, 0, 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector3.Zero(), this._scene);
42479
42515
  // This attaches the mouse controls
42480
42516
  this.addControls(this._scene);
@@ -42495,27 +42531,11 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
42495
42531
  ev.object.markAsDirty(false);
42496
42532
  this.props.globalState.onWindowResizeObservable.notifyObservers();
42497
42533
  });
42498
- // Every time the original ADT re-renders, we must also re-render, so that layout information is computed correctly
42499
- // also, every time *we* re-render (due to a change in the GUI), we must re-render the original ADT
42500
- // to prevent an infinite loop, we flip a boolean flag
42534
+ const throttledSynchronization = throttle(() => {
42535
+ this._copyEditorGUIToLiveGUI();
42536
+ }, 33);
42501
42537
  if (this.props.globalState.liveGuiTexture) {
42502
- this._guiRenderObserver = this.props.globalState.guiTexture.onBeginRenderObservable.add(() => {
42503
- if (this._liveGuiTextureRerender) {
42504
- this._nextLiveGuiRender = Date.now() + this._liveGuiRerenderDelay;
42505
- }
42506
- this._liveGuiTextureRerender = true;
42507
- });
42508
- this._liveRenderObserver = this.props.globalState.liveGuiTexture.onEndRenderObservable.add(() => {
42509
- // return the GUI to the editor mode
42510
- this.props.globalState.guiTexture?.markAsDirty();
42511
- this._liveGuiTextureRerender = false;
42512
- });
42513
- this._scene.onAfterRenderObservable.add(() => {
42514
- if (this._nextLiveGuiRender > 0 && Date.now() > this._nextLiveGuiRender) {
42515
- this._nextLiveGuiRender = -1;
42516
- this.props.globalState.liveGuiTexture?.markAsDirty();
42517
- }
42518
- });
42538
+ this._guiRenderObserver = this.props.globalState.guiTexture.onEndRenderObservable.add(throttledSynchronization);
42519
42539
  }
42520
42540
  this._engine.runRenderLoop(() => {
42521
42541
  this._scene.render();
@@ -42765,6 +42785,7 @@ class GlobalState {
42765
42785
  this.onPasteObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.Observable();
42766
42786
  this.isSaving = false;
42767
42787
  this.lockObject = new shared_ui_components_tabs_propertyGrids_lockObject__WEBPACK_IMPORTED_MODULE_1__.LockObject();
42788
+ this.shiftKeyPressed = false;
42768
42789
  this.controlCamera = core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataStorage.ReadBoolean("ControlCamera", true);
42769
42790
  const defaultBrightness = 204 / 255.0;
42770
42791
  const r = core_Misc_observable__WEBPACK_IMPORTED_MODULE_0__.DataStorage.ReadNumber("BackgroundColorR", defaultBrightness);
@@ -43213,7 +43234,7 @@ class GUINodeTools {
43213
43234
  }
43214
43235
  }
43215
43236
  }
43216
- GUINodeTools.ImageControlDefaultUrl = "./imageControlDefault.jpg";
43237
+ GUINodeTools.ImageControlDefaultUrl = "https://assets.babylonjs.com/textures/Checker_albedo.png";
43217
43238
 
43218
43239
 
43219
43240
  /***/ }),