@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/README.md
CHANGED
|
@@ -470,6 +470,14 @@ DIVECommunication class via
|
|
|
470
470
|
Sets the gizmo's mode.
|
|
471
471
|
</td>
|
|
472
472
|
</tr>
|
|
473
|
+
<tr>
|
|
474
|
+
<td>
|
|
475
|
+
<a href="src/com/actions/toolbox/transform/setgizmoscalelinked.ts"> SET_GIZMO_SCALE_LINKED </a>
|
|
476
|
+
</td>
|
|
477
|
+
<td>
|
|
478
|
+
Sets the gizmo's unified scale mode.
|
|
479
|
+
</td>
|
|
480
|
+
</tr>
|
|
473
481
|
<tr>
|
|
474
482
|
<td>
|
|
475
483
|
<a href="src/com/actions/toolbox/transform/setgizmovisible.ts"> SET_GIZMO_VISIBILITY </a>
|
package/build/dive.cjs
CHANGED
|
@@ -324,6 +324,20 @@ var init_BaseTool = __esm({
|
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
326
|
|
|
327
|
+
// src/constant/AxisHelperColors.ts
|
|
328
|
+
var AxesColorRedLetter, AxesColorGreenLetter, AxesColorBlueLetter, AxesColorRed, AxesColorGreen, AxesColorBlue;
|
|
329
|
+
var init_AxisHelperColors = __esm({
|
|
330
|
+
"src/constant/AxisHelperColors.ts"() {
|
|
331
|
+
"use strict";
|
|
332
|
+
AxesColorRedLetter = "#c20017";
|
|
333
|
+
AxesColorGreenLetter = "#00ab26";
|
|
334
|
+
AxesColorBlueLetter = "#0081d4";
|
|
335
|
+
AxesColorRed = AxesColorRedLetter;
|
|
336
|
+
AxesColorGreen = AxesColorGreenLetter;
|
|
337
|
+
AxesColorBlue = AxesColorBlueLetter;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
|
|
327
341
|
// src/toolbox/transform/TransformTool.ts
|
|
328
342
|
var import_TransformControls, DIVETransformTool;
|
|
329
343
|
var init_TransformTool = __esm({
|
|
@@ -332,11 +346,13 @@ var init_TransformTool = __esm({
|
|
|
332
346
|
init_BaseTool();
|
|
333
347
|
import_TransformControls = require("three/examples/jsm/controls/TransformControls");
|
|
334
348
|
init_implementsInterface();
|
|
349
|
+
init_AxisHelperColors();
|
|
335
350
|
DIVETransformTool = class extends DIVEBaseTool {
|
|
336
351
|
constructor(scene, controller) {
|
|
337
352
|
super(scene, controller);
|
|
338
353
|
this.isTransformTool = true;
|
|
339
354
|
this.name = "DIVETransformTool";
|
|
355
|
+
this._scaleLinked = false;
|
|
340
356
|
this._gizmo = this.initGizmo();
|
|
341
357
|
this._scene.add(this._gizmo);
|
|
342
358
|
}
|
|
@@ -359,6 +375,9 @@ var init_TransformTool = __esm({
|
|
|
359
375
|
}
|
|
360
376
|
}
|
|
361
377
|
}
|
|
378
|
+
SetGizmoScaleLinked(linked) {
|
|
379
|
+
this._scaleLinked = linked;
|
|
380
|
+
}
|
|
362
381
|
// only used for optimizing pointer events with DIVEGizmo
|
|
363
382
|
// public onPointerDown(e: PointerEvent): void {
|
|
364
383
|
// super.onPointerDown(e);
|
|
@@ -379,6 +398,28 @@ var init_TransformTool = __esm({
|
|
|
379
398
|
this._controller.domElement
|
|
380
399
|
);
|
|
381
400
|
g.mode = "translate";
|
|
401
|
+
g.traverse((child) => {
|
|
402
|
+
if (!("isMesh" in child)) return;
|
|
403
|
+
const material = child.material;
|
|
404
|
+
if (child.name === "X") {
|
|
405
|
+
material.color.set(AxesColorRed);
|
|
406
|
+
}
|
|
407
|
+
if (child.name === "Y") {
|
|
408
|
+
material.color.set(AxesColorGreen);
|
|
409
|
+
}
|
|
410
|
+
if (child.name === "Z") {
|
|
411
|
+
material.color.set(AxesColorBlue);
|
|
412
|
+
}
|
|
413
|
+
if (child.name === "XY") {
|
|
414
|
+
material.color.set(AxesColorBlue);
|
|
415
|
+
}
|
|
416
|
+
if (child.name === "YZ") {
|
|
417
|
+
material.color.set(AxesColorRed);
|
|
418
|
+
}
|
|
419
|
+
if (child.name === "XZ") {
|
|
420
|
+
material.color.set(AxesColorGreen);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
382
423
|
g.addEventListener("mouseDown", () => {
|
|
383
424
|
this._controller.enabled = false;
|
|
384
425
|
if (!implementsInterface(g.object, "isMovable"))
|
|
@@ -391,6 +432,11 @@ var init_TransformTool = __esm({
|
|
|
391
432
|
return;
|
|
392
433
|
if (!g.object.onMove) return;
|
|
393
434
|
g.object.onMove();
|
|
435
|
+
if (this._scaleLinked) {
|
|
436
|
+
const scale = g.object.scale;
|
|
437
|
+
const averageScale = (scale.x + scale.y + scale.z) / 3;
|
|
438
|
+
g.object.scale.set(averageScale, averageScale, averageScale);
|
|
439
|
+
}
|
|
394
440
|
});
|
|
395
441
|
g.addEventListener("mouseUp", () => {
|
|
396
442
|
this._controller.enabled = true;
|
|
@@ -2420,6 +2466,12 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
2420
2466
|
);
|
|
2421
2467
|
break;
|
|
2422
2468
|
}
|
|
2469
|
+
case "SET_GIZMO_SCALE_LINKED": {
|
|
2470
|
+
returnValue = this.setGizmoScaleLinked(
|
|
2471
|
+
payload
|
|
2472
|
+
);
|
|
2473
|
+
break;
|
|
2474
|
+
}
|
|
2423
2475
|
case "USE_TOOL": {
|
|
2424
2476
|
returnValue = this.useTool(
|
|
2425
2477
|
payload
|
|
@@ -2684,6 +2736,11 @@ var _DIVECommunication = class _DIVECommunication {
|
|
|
2684
2736
|
this.toolbox.SetGizmoVisibility(payload);
|
|
2685
2737
|
return payload;
|
|
2686
2738
|
}
|
|
2739
|
+
setGizmoScaleLinked(payload) {
|
|
2740
|
+
console.log("SET_GIZMO_SCALE_LINKED", payload);
|
|
2741
|
+
this.toolbox.SetGizmoScaleLinked(payload);
|
|
2742
|
+
return payload;
|
|
2743
|
+
}
|
|
2687
2744
|
useTool(payload) {
|
|
2688
2745
|
this.toolbox.UseTool(payload.tool);
|
|
2689
2746
|
return true;
|
|
@@ -4222,6 +4279,9 @@ var DIVEToolbox = class {
|
|
|
4222
4279
|
SetGizmoVisibility(active) {
|
|
4223
4280
|
this.selectTool.SetGizmoVisibility(active);
|
|
4224
4281
|
}
|
|
4282
|
+
SetGizmoScaleLinked(linked) {
|
|
4283
|
+
this.selectTool.SetGizmoScaleLinked(linked);
|
|
4284
|
+
}
|
|
4225
4285
|
onPointerMove(e) {
|
|
4226
4286
|
var _a;
|
|
4227
4287
|
(_a = this._activeTool) == null ? void 0 : _a.onPointerMove(e);
|
|
@@ -4301,16 +4361,7 @@ var DIVEAnimationSystem = class {
|
|
|
4301
4361
|
var import_three25 = require("three");
|
|
4302
4362
|
var import_three_spritetext = __toESM(require("three-spritetext"), 1);
|
|
4303
4363
|
init_VisibilityLayerMask();
|
|
4304
|
-
|
|
4305
|
-
// src/constant/AxisHelperColors.ts
|
|
4306
|
-
var AxesColorRedLetter = "#c20017";
|
|
4307
|
-
var AxesColorGreenLetter = "#00ab26";
|
|
4308
|
-
var AxesColorBlueLetter = "#0081d4";
|
|
4309
|
-
var AxesColorRed = AxesColorRedLetter;
|
|
4310
|
-
var AxesColorGreen = AxesColorGreenLetter;
|
|
4311
|
-
var AxesColorBlue = AxesColorBlueLetter;
|
|
4312
|
-
|
|
4313
|
-
// src/axiscamera/AxisCamera.ts
|
|
4364
|
+
init_AxisHelperColors();
|
|
4314
4365
|
var DIVEAxisCamera = class extends import_three25.OrthographicCamera {
|
|
4315
4366
|
constructor(renderer, scene, controls) {
|
|
4316
4367
|
super(-1, 1, 1, -1, 0.1, 100);
|
|
@@ -4438,7 +4489,7 @@ init_Info();
|
|
|
4438
4489
|
// package.json
|
|
4439
4490
|
var package_default = {
|
|
4440
4491
|
name: "@shopware-ag/dive",
|
|
4441
|
-
version: "1.18.
|
|
4492
|
+
version: "1.18.3",
|
|
4442
4493
|
description: "Shopware Spatial Framework",
|
|
4443
4494
|
type: "module",
|
|
4444
4495
|
main: "./build/dive.cjs",
|