@shopware-ag/dive 1.18.2 → 1.18.3
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.
- package/README.md +8 -0
- package/build/dive.cjs +62 -11
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +11 -0
- package/build/dive.d.ts +11 -0
- package/build/dive.js +62 -11
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/com/Communication.ts +14 -0
- package/src/com/actions/index.ts +2 -0
- package/src/com/actions/toolbox/transform/setgizmoscalelinked.ts +5 -0
- package/src/toolbox/Toolbox.ts +4 -0
- package/src/toolbox/__test__/Toolbox.test.ts +6 -0
- package/src/toolbox/transform/TransformTool.ts +46 -1
- package/src/toolbox/transform/__test__/TransformTool.test.ts +15 -0
package/build/dive.d.cts
CHANGED
|
@@ -595,6 +595,12 @@ interface SET_GIZMO_VISIBILITY {
|
|
|
595
595
|
RETURN: boolean;
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
+
interface SET_GIZMO_SCALE_LINKED {
|
|
599
|
+
DESCRIPTION: "Sets the gizmo's unified scale mode.";
|
|
600
|
+
PAYLOAD: boolean;
|
|
601
|
+
RETURN: boolean;
|
|
602
|
+
}
|
|
603
|
+
|
|
598
604
|
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
599
605
|
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
600
606
|
PAYLOAD: object;
|
|
@@ -845,11 +851,13 @@ declare class DIVEGizmo extends Object3D {
|
|
|
845
851
|
*/
|
|
846
852
|
declare class DIVETransformTool extends DIVEBaseTool {
|
|
847
853
|
readonly isTransformTool: boolean;
|
|
854
|
+
private _scaleLinked;
|
|
848
855
|
protected _gizmo: TransformControls | DIVEGizmo;
|
|
849
856
|
constructor(scene: DIVEScene, controller: DIVEOrbitControls);
|
|
850
857
|
Activate(): void;
|
|
851
858
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
852
859
|
SetGizmoVisibility(active: boolean): void;
|
|
860
|
+
SetGizmoScaleLinked(linked: boolean): void;
|
|
853
861
|
private initGizmo;
|
|
854
862
|
}
|
|
855
863
|
|
|
@@ -890,6 +898,7 @@ declare class DIVEToolbox {
|
|
|
890
898
|
UseTool(tool: ToolType): void;
|
|
891
899
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
892
900
|
SetGizmoVisibility(active: boolean): void;
|
|
901
|
+
SetGizmoScaleLinked(linked: boolean): void;
|
|
893
902
|
onPointerMove(e: PointerEvent): void;
|
|
894
903
|
onPointerDown(e: PointerEvent): void;
|
|
895
904
|
onPointerUp(e: PointerEvent): void;
|
|
@@ -963,6 +972,7 @@ interface Actions {
|
|
|
963
972
|
ZOOM_CAMERA: ZOOM_CAMERA;
|
|
964
973
|
SET_GIZMO_MODE: SET_GIZMO_MODE;
|
|
965
974
|
SET_GIZMO_VISIBILITY: SET_GIZMO_VISIBILITY;
|
|
975
|
+
SET_GIZMO_SCALE_LINKED: SET_GIZMO_SCALE_LINKED;
|
|
966
976
|
USE_TOOL: USE_TOOL;
|
|
967
977
|
MODEL_LOADED: MODEL_LOADED;
|
|
968
978
|
UPDATE_SCENE: UPDATE_SCENE;
|
|
@@ -1035,6 +1045,7 @@ declare class DIVECommunication {
|
|
|
1035
1045
|
private zoomCamera;
|
|
1036
1046
|
private setGizmoMode;
|
|
1037
1047
|
private setGizmoVisibility;
|
|
1048
|
+
private setGizmoScaleLinked;
|
|
1038
1049
|
private useTool;
|
|
1039
1050
|
private modelLoaded;
|
|
1040
1051
|
private updateScene;
|
package/build/dive.d.ts
CHANGED
|
@@ -595,6 +595,12 @@ interface SET_GIZMO_VISIBILITY {
|
|
|
595
595
|
RETURN: boolean;
|
|
596
596
|
}
|
|
597
597
|
|
|
598
|
+
interface SET_GIZMO_SCALE_LINKED {
|
|
599
|
+
DESCRIPTION: "Sets the gizmo's unified scale mode.";
|
|
600
|
+
PAYLOAD: boolean;
|
|
601
|
+
RETURN: boolean;
|
|
602
|
+
}
|
|
603
|
+
|
|
598
604
|
interface COMPUTE_ENCOMPASSING_VIEW {
|
|
599
605
|
DESCRIPTION: 'Calculates the camera position and target to view the whole scene. (experimental)';
|
|
600
606
|
PAYLOAD: object;
|
|
@@ -845,11 +851,13 @@ declare class DIVEGizmo extends Object3D {
|
|
|
845
851
|
*/
|
|
846
852
|
declare class DIVETransformTool extends DIVEBaseTool {
|
|
847
853
|
readonly isTransformTool: boolean;
|
|
854
|
+
private _scaleLinked;
|
|
848
855
|
protected _gizmo: TransformControls | DIVEGizmo;
|
|
849
856
|
constructor(scene: DIVEScene, controller: DIVEOrbitControls);
|
|
850
857
|
Activate(): void;
|
|
851
858
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
852
859
|
SetGizmoVisibility(active: boolean): void;
|
|
860
|
+
SetGizmoScaleLinked(linked: boolean): void;
|
|
853
861
|
private initGizmo;
|
|
854
862
|
}
|
|
855
863
|
|
|
@@ -890,6 +898,7 @@ declare class DIVEToolbox {
|
|
|
890
898
|
UseTool(tool: ToolType): void;
|
|
891
899
|
SetGizmoMode(mode: 'translate' | 'rotate' | 'scale'): void;
|
|
892
900
|
SetGizmoVisibility(active: boolean): void;
|
|
901
|
+
SetGizmoScaleLinked(linked: boolean): void;
|
|
893
902
|
onPointerMove(e: PointerEvent): void;
|
|
894
903
|
onPointerDown(e: PointerEvent): void;
|
|
895
904
|
onPointerUp(e: PointerEvent): void;
|
|
@@ -963,6 +972,7 @@ interface Actions {
|
|
|
963
972
|
ZOOM_CAMERA: ZOOM_CAMERA;
|
|
964
973
|
SET_GIZMO_MODE: SET_GIZMO_MODE;
|
|
965
974
|
SET_GIZMO_VISIBILITY: SET_GIZMO_VISIBILITY;
|
|
975
|
+
SET_GIZMO_SCALE_LINKED: SET_GIZMO_SCALE_LINKED;
|
|
966
976
|
USE_TOOL: USE_TOOL;
|
|
967
977
|
MODEL_LOADED: MODEL_LOADED;
|
|
968
978
|
UPDATE_SCENE: UPDATE_SCENE;
|
|
@@ -1035,6 +1045,7 @@ declare class DIVECommunication {
|
|
|
1035
1045
|
private zoomCamera;
|
|
1036
1046
|
private setGizmoMode;
|
|
1037
1047
|
private setGizmoVisibility;
|
|
1048
|
+
private setGizmoScaleLinked;
|
|
1038
1049
|
private useTool;
|
|
1039
1050
|
private modelLoaded;
|
|
1040
1051
|
private updateScene;
|
package/build/dive.js
CHANGED
|
@@ -317,6 +317,20 @@ var init_BaseTool = __esm({
|
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
319
|
|
|
320
|
+
// src/constant/AxisHelperColors.ts
|
|
321
|
+
var AxesColorRedLetter, AxesColorGreenLetter, AxesColorBlueLetter, AxesColorRed, AxesColorGreen, AxesColorBlue;
|
|
322
|
+
var init_AxisHelperColors = __esm({
|
|
323
|
+
"src/constant/AxisHelperColors.ts"() {
|
|
324
|
+
"use strict";
|
|
325
|
+
AxesColorRedLetter = "#c20017";
|
|
326
|
+
AxesColorGreenLetter = "#00ab26";
|
|
327
|
+
AxesColorBlueLetter = "#0081d4";
|
|
328
|
+
AxesColorRed = AxesColorRedLetter;
|
|
329
|
+
AxesColorGreen = AxesColorGreenLetter;
|
|
330
|
+
AxesColorBlue = AxesColorBlueLetter;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
|
|
320
334
|
// src/toolbox/transform/TransformTool.ts
|
|
321
335
|
import { TransformControls } from "three/examples/jsm/controls/TransformControls";
|
|
322
336
|
var DIVETransformTool;
|
|
@@ -325,11 +339,13 @@ var init_TransformTool = __esm({
|
|
|
325
339
|
"use strict";
|
|
326
340
|
init_BaseTool();
|
|
327
341
|
init_implementsInterface();
|
|
342
|
+
init_AxisHelperColors();
|
|
328
343
|
DIVETransformTool = class extends DIVEBaseTool {
|
|
329
344
|
constructor(scene, controller) {
|
|
330
345
|
super(scene, controller);
|
|
331
346
|
this.isTransformTool = true;
|
|
332
347
|
this.name = "DIVETransformTool";
|
|
348
|
+
this._scaleLinked = false;
|
|
333
349
|
this._gizmo = this.initGizmo();
|
|
334
350
|
this._scene.add(this._gizmo);
|
|
335
351
|
}
|
|
@@ -352,6 +368,9 @@ var init_TransformTool = __esm({
|
|
|
352
368
|
}
|
|
353
369
|
}
|
|
354
370
|
}
|
|
371
|
+
SetGizmoScaleLinked(linked) {
|
|
372
|
+
this._scaleLinked = linked;
|
|
373
|
+
}
|
|
355
374
|
// only used for optimizing pointer events with DIVEGizmo
|
|
356
375
|
// public onPointerDown(e: PointerEvent): void {
|
|
357
376
|
// super.onPointerDown(e);
|
|
@@ -372,6 +391,28 @@ var init_TransformTool = __esm({
|
|
|
372
391
|
this._controller.domElement
|
|
373
392
|
);
|
|
374
393
|
g.mode = "translate";
|
|
394
|
+
g.traverse((child) => {
|
|
395
|
+
if (!("isMesh" in child)) return;
|
|
396
|
+
const material = child.material;
|
|
397
|
+
if (child.name === "X") {
|
|
398
|
+
material.color.set(AxesColorRed);
|
|
399
|
+
}
|
|
400
|
+
if (child.name === "Y") {
|
|
401
|
+
material.color.set(AxesColorGreen);
|
|
402
|
+
}
|
|
403
|
+
if (child.name === "Z") {
|
|
404
|
+
material.color.set(AxesColorBlue);
|
|
405
|
+
}
|
|
406
|
+
if (child.name === "XY") {
|
|
407
|
+
material.color.set(AxesColorBlue);
|
|
408
|
+
}
|
|
409
|
+
if (child.name === "YZ") {
|
|
410
|
+
material.color.set(AxesColorRed);
|
|
411
|
+
}
|
|
412
|
+
if (child.name === "XZ") {
|
|
413
|
+
material.color.set(AxesColorGreen);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
375
416
|
g.addEventListener("mouseDown", () => {
|
|
376
417
|
this._controller.enabled = false;
|
|
377
418
|
if (!implementsInterface(g.object, "isMovable"))
|
|
@@ -384,6 +425,11 @@ var init_TransformTool = __esm({
|
|
|
384
425
|
return;
|
|
385
426
|
if (!g.object.onMove) return;
|
|
386
427
|
g.object.onMove();
|
|
428
|
+
if (this._scaleLinked) {
|
|
429
|
+
const scale = g.object.scale;
|
|
430
|
+
const averageScale = (scale.x + scale.y + scale.z) / 3;
|
|
431
|
+
g.object.scale.set(averageScale, averageScale, averageScale);
|
|
432
|
+
}
|
|
387
433
|
});
|
|
388
434
|
g.addEventListener("mouseUp", () => {
|
|
389
435
|
this._controller.enabled = true;
|
|
@@ -2423,6 +2469,12 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
2423
2469
|
);
|
|
2424
2470
|
break;
|
|
2425
2471
|
}
|
|
2472
|
+
case "SET_GIZMO_SCALE_LINKED": {
|
|
2473
|
+
returnValue = this.setGizmoScaleLinked(
|
|
2474
|
+
payload
|
|
2475
|
+
);
|
|
2476
|
+
break;
|
|
2477
|
+
}
|
|
2426
2478
|
case "USE_TOOL": {
|
|
2427
2479
|
returnValue = this.useTool(
|
|
2428
2480
|
payload
|
|
@@ -2687,6 +2739,11 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
2687
2739
|
this.toolbox.SetGizmoVisibility(payload);
|
|
2688
2740
|
return payload;
|
|
2689
2741
|
}
|
|
2742
|
+
setGizmoScaleLinked(payload) {
|
|
2743
|
+
console.log("SET_GIZMO_SCALE_LINKED", payload);
|
|
2744
|
+
this.toolbox.SetGizmoScaleLinked(payload);
|
|
2745
|
+
return payload;
|
|
2746
|
+
}
|
|
2690
2747
|
useTool(payload) {
|
|
2691
2748
|
this.toolbox.UseTool(payload.tool);
|
|
2692
2749
|
return true;
|
|
@@ -4247,6 +4304,9 @@ var DIVEToolbox = class {
|
|
|
4247
4304
|
SetGizmoVisibility(active) {
|
|
4248
4305
|
this.selectTool.SetGizmoVisibility(active);
|
|
4249
4306
|
}
|
|
4307
|
+
SetGizmoScaleLinked(linked) {
|
|
4308
|
+
this.selectTool.SetGizmoScaleLinked(linked);
|
|
4309
|
+
}
|
|
4250
4310
|
onPointerMove(e) {
|
|
4251
4311
|
var _a;
|
|
4252
4312
|
(_a = this._activeTool) == null ? void 0 : _a.onPointerMove(e);
|
|
@@ -4324,6 +4384,7 @@ var DIVEAnimationSystem = class {
|
|
|
4324
4384
|
|
|
4325
4385
|
// src/axiscamera/AxisCamera.ts
|
|
4326
4386
|
init_VisibilityLayerMask();
|
|
4387
|
+
init_AxisHelperColors();
|
|
4327
4388
|
import {
|
|
4328
4389
|
AxesHelper,
|
|
4329
4390
|
Color as Color8,
|
|
@@ -4332,16 +4393,6 @@ import {
|
|
|
4332
4393
|
Vector4
|
|
4333
4394
|
} from "three";
|
|
4334
4395
|
import SpriteText from "three-spritetext";
|
|
4335
|
-
|
|
4336
|
-
// src/constant/AxisHelperColors.ts
|
|
4337
|
-
var AxesColorRedLetter = "#c20017";
|
|
4338
|
-
var AxesColorGreenLetter = "#00ab26";
|
|
4339
|
-
var AxesColorBlueLetter = "#0081d4";
|
|
4340
|
-
var AxesColorRed = AxesColorRedLetter;
|
|
4341
|
-
var AxesColorGreen = AxesColorGreenLetter;
|
|
4342
|
-
var AxesColorBlue = AxesColorBlueLetter;
|
|
4343
|
-
|
|
4344
|
-
// src/axiscamera/AxisCamera.ts
|
|
4345
4396
|
var DIVEAxisCamera = class extends OrthographicCamera {
|
|
4346
4397
|
constructor(renderer, scene, controls) {
|
|
4347
4398
|
super(-1, 1, 1, -1, 0.1, 100);
|
|
@@ -4469,7 +4520,7 @@ import { MathUtils as MathUtils5 } from "three";
|
|
|
4469
4520
|
// package.json
|
|
4470
4521
|
var package_default = {
|
|
4471
4522
|
name: "@shopware-ag/dive",
|
|
4472
|
-
version: "1.18.
|
|
4523
|
+
version: "1.18.3",
|
|
4473
4524
|
description: "Shopware Spatial Framework",
|
|
4474
4525
|
type: "module",
|
|
4475
4526
|
main: "./build/dive.cjs",
|