@babylonjs/gui-editor 5.43.1 → 5.44.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.
@@ -41984,6 +41984,8 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
|
41984
41984
|
this._controlsHit = [];
|
41985
41985
|
this._pointerTravelDistance = 0;
|
41986
41986
|
this._processSelectionOnUp = false;
|
41987
|
+
this._centerZoomMousePosition = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(0, 0);
|
41988
|
+
this._hasPerformedDragZoom = false;
|
41987
41989
|
this._defaultGUISize = { width: 1024, height: 1024 };
|
41988
41990
|
this._initialPanningOffset = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(0, 0);
|
41989
41991
|
this._panningOffset = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(0, 0);
|
@@ -42617,13 +42619,13 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
|
42617
42619
|
if (this.props.globalState.tool === _globalState__WEBPACK_IMPORTED_MODULE_2__.GUIEditorTool.SELECT) {
|
42618
42620
|
this._mouseStartPoint = this.getScaledPointerPosition();
|
42619
42621
|
}
|
42622
|
+
if (this.props.globalState.tool === _globalState__WEBPACK_IMPORTED_MODULE_2__.GUIEditorTool.ZOOM) {
|
42623
|
+
this._centerZoomMousePosition.set(this._scene.pointerX, this._scene.pointerY);
|
42624
|
+
}
|
42620
42625
|
if (evt.buttons & 4 || this.props.globalState.tool === _globalState__WEBPACK_IMPORTED_MODULE_2__.GUIEditorTool.PAN) {
|
42621
42626
|
this.startPanning();
|
42622
42627
|
}
|
42623
42628
|
else {
|
42624
|
-
if (this.props.globalState.tool === _globalState__WEBPACK_IMPORTED_MODULE_2__.GUIEditorTool.ZOOM) {
|
42625
|
-
this.zooming(1.0 + (this.props.globalState.keys.isKeyDown("alt") ? -this._zoomModeIncrement : this._zoomModeIncrement));
|
42626
|
-
}
|
42627
42629
|
this.endPanning();
|
42628
42630
|
// process selection
|
42629
42631
|
if (this.props.globalState.selectedControls.length !== 0) {
|
@@ -42640,7 +42642,13 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
|
42640
42642
|
}
|
42641
42643
|
}
|
42642
42644
|
onUp(evt) {
|
42645
|
+
if (this.props.globalState.tool === _globalState__WEBPACK_IMPORTED_MODULE_2__.GUIEditorTool.ZOOM && !this._hasPerformedDragZoom) {
|
42646
|
+
this._panZoomToCenter(1000 * this._zoomModeIncrement, new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(this._scene.pointerX, this._scene.pointerY));
|
42647
|
+
this.zooming(1.0 + (this.props.globalState.keys.isKeyDown("alt") ? -this._zoomModeIncrement : this._zoomModeIncrement));
|
42648
|
+
}
|
42649
|
+
this._hasPerformedDragZoom = false;
|
42643
42650
|
this._mouseStartPoint = null;
|
42651
|
+
this._centerZoomMousePosition.set(0, 0);
|
42644
42652
|
this._constraintDirection = ConstraintDirection.NONE;
|
42645
42653
|
this._rootContainer.current?.releasePointerCapture(evt.pointerId);
|
42646
42654
|
this._panning = false;
|
@@ -42827,20 +42835,26 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
|
42827
42835
|
else if (event.detail) {
|
42828
42836
|
delta = -event.detail;
|
42829
42837
|
}
|
42830
|
-
const
|
42838
|
+
const mouseCenter = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_4__.Vector2(this._scene.pointerX, this._scene.pointerY);
|
42839
|
+
this._panZoomToCenter(delta, mouseCenter);
|
42840
|
+
this.zooming(1 + delta / 1000);
|
42841
|
+
}
|
42842
|
+
_panZoomToCenter(delta, mouseCenter) {
|
42843
|
+
const mouseToRtt = _coordinateHelper__WEBPACK_IMPORTED_MODULE_6__.CoordinateHelper.MousePointerToRTTSpace(this.trueRootContainer, mouseCenter.x, mouseCenter.y);
|
42831
42844
|
const rttToLocal = _coordinateHelper__WEBPACK_IMPORTED_MODULE_6__.CoordinateHelper.RttToLocalNodeSpace(this.trueRootContainer, mouseToRtt.x, mouseToRtt.y);
|
42832
42845
|
const centerToRtt = _coordinateHelper__WEBPACK_IMPORTED_MODULE_6__.CoordinateHelper.MousePointerToRTTSpace(this.trueRootContainer, this._engine.getRenderWidth() / 2, this._engine.getRenderHeight() / 2);
|
42833
42846
|
const centerToLocal = _coordinateHelper__WEBPACK_IMPORTED_MODULE_6__.CoordinateHelper.RttToLocalNodeSpace(this.trueRootContainer, centerToRtt.x, centerToRtt.y);
|
42834
42847
|
const panScale = -delta / 1000;
|
42835
42848
|
const deltaCenter = rttToLocal.subtract(centerToLocal).scale(panScale).multiplyByFloats(1, -1);
|
42836
42849
|
this._panningOffset.addInPlace(deltaCenter);
|
42837
|
-
this.zooming(1 + delta / 1000);
|
42838
42850
|
}
|
42839
42851
|
zoomDrag(event) {
|
42840
42852
|
let delta = 0;
|
42841
42853
|
if (event.movementY !== 0) {
|
42842
42854
|
delta = -event.movementY;
|
42843
42855
|
}
|
42856
|
+
this._hasPerformedDragZoom = true;
|
42857
|
+
this._panZoomToCenter(delta, this._centerZoomMousePosition);
|
42844
42858
|
this.zooming(1 + delta / 1000);
|
42845
42859
|
}
|
42846
42860
|
//Zoom to pointer position. Zoom amount determined by delta
|
@@ -42868,7 +42882,7 @@ class WorkbenchComponent extends react__WEBPACK_IMPORTED_MODULE_1__.Component {
|
|
42868
42882
|
cursor = this.props.globalState.keys.isKeyDown("alt") ? "zoom-out" : "zoom-in";
|
42869
42883
|
}
|
42870
42884
|
return ((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("canvas", { id: "workbench-canvas", onPointerMove: (evt) => {
|
42871
|
-
if (this._mouseDown) {
|
42885
|
+
if (this._mouseDown && this.props.globalState.tool === _globalState__WEBPACK_IMPORTED_MODULE_2__.GUIEditorTool.ZOOM) {
|
42872
42886
|
this.zoomDrag(evt);
|
42873
42887
|
}
|
42874
42888
|
if (this.props.globalState.guiTexture) {
|