vim-web 0.3.44-dev.81 → 0.3.44-dev.83

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/dist/vim-web.js CHANGED
@@ -47889,10 +47889,16 @@ function createGhostMaterial() {
47889
47889
  },
47890
47890
  uniforms: {
47891
47891
  // Uniform controlling the overall transparency of the non-visible objects.
47892
- opacity: { value: 1e-3 },
47892
+ opacity: { value: 0.25 },
47893
47893
  // Uniform specifying the fill color for non-visible objects.
47894
- fillColor: { value: new Vector3(0, 0, 0) }
47894
+ fillColor: { value: new Vector3(14 / 255, 14 / 255, 14 / 255) }
47895
47895
  },
47896
+ /*
47897
+ blending: THREE.CustomBlending,
47898
+ blendSrc: THREE.SrcAlphaFactor,
47899
+ blendEquation: THREE.AddEquation,
47900
+ blendDst: THREE.OneMinusDstColorFactor,
47901
+ */
47896
47902
  // Render only the front side of faces to prevent drawing internal geometry.
47897
47903
  side: FrontSide,
47898
47904
  // Enable support for vertex colors.
@@ -47942,7 +47948,8 @@ function createGhostMaterial() {
47942
47948
  // Handle clipping planes to discard fragments outside the defined planes.
47943
47949
  #include <clipping_planes_fragment>
47944
47950
  // Set the fragment color to the specified fill color and opacity.
47945
- gl_FragColor = vec4(fillColor, opacity);
47951
+ // Divided by 10 just to match Ultra ghost opacity at 0.25
47952
+ gl_FragColor = vec4(fillColor, opacity / 10.0);
47946
47953
  }
47947
47954
  `
47948
47955
  )
@@ -52448,6 +52455,7 @@ class MouseHandler extends BaseInputHandler {
52448
52455
  __publicField(this, "_lastMouseDownPosition", new Vector2(0, 0));
52449
52456
  __publicField(this, "_capture");
52450
52457
  __publicField(this, "_dragHandler");
52458
+ __publicField(this, "_doubleClickHandler", new DoubleClickHandler());
52451
52459
  __publicField(this, "onButtonDown");
52452
52460
  __publicField(this, "onButtonUp");
52453
52461
  __publicField(this, "onMouseMove");
@@ -52457,29 +52465,29 @@ class MouseHandler extends BaseInputHandler {
52457
52465
  __publicField(this, "onDoubleClick");
52458
52466
  __publicField(this, "onWheel");
52459
52467
  this._capture = new CaptureStateMachine(canvas);
52460
- this._dragHandler = new DragHandler(canvas, (delta, button) => this.onDrag(delta, button));
52468
+ this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
52461
52469
  }
52462
52470
  addListeners() {
52463
52471
  this.reg(this._canvas, "pointerdown", (e) => {
52464
- this.onPointerDown(e);
52472
+ this.handlePointerDown(e);
52465
52473
  });
52466
52474
  this.reg(this._canvas, "pointerup", (e) => {
52467
- this.onPointerUp(e);
52475
+ this.handlePointerUp(e);
52468
52476
  });
52469
52477
  this.reg(this._canvas, "pointermove", (e) => {
52470
- this.onPointerMove(e);
52478
+ this.handlePointerMove(e);
52471
52479
  });
52472
52480
  this.reg(this._canvas, "wheel", (e) => {
52473
52481
  this.onMouseScroll(e);
52474
52482
  });
52475
52483
  this.reg(this._canvas, "dblclick", (e) => {
52476
- this._onDoubleClick(e);
52484
+ this.handleDoubleClick(e);
52477
52485
  });
52478
52486
  }
52479
52487
  dispose() {
52480
52488
  this.unregister();
52481
52489
  }
52482
- onPointerDown(event) {
52490
+ handlePointerDown(event) {
52483
52491
  var _a3;
52484
52492
  if (event.pointerType !== "mouse") return;
52485
52493
  const pos = this.relativePosition(event);
@@ -52489,20 +52497,25 @@ class MouseHandler extends BaseInputHandler {
52489
52497
  this._capture.onPointerDown(event);
52490
52498
  event.preventDefault();
52491
52499
  }
52492
- onPointerUp(event) {
52500
+ handlePointerUp(event) {
52493
52501
  var _a3;
52494
52502
  if (event.pointerType !== "mouse") return;
52495
52503
  const pos = this.relativePosition(event);
52496
52504
  (_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
52497
- this.handleMouseClick(event);
52498
52505
  this._capture.onPointerUp(event);
52499
52506
  this._dragHandler.onPointerUp();
52507
+ if (this._doubleClickHandler.checkForDoubleClick(event)) {
52508
+ this.handleDoubleClick(event);
52509
+ } else {
52510
+ this.handleMouseClick(event);
52511
+ }
52500
52512
  event.preventDefault();
52501
52513
  }
52502
52514
  async handleMouseClick(event) {
52503
52515
  var _a3;
52504
52516
  if (event.pointerType !== "mouse") return;
52505
52517
  if (event.button !== 0) return;
52518
+ console.log("click!");
52506
52519
  const pos = this.relativePosition(event);
52507
52520
  if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
52508
52521
  return;
@@ -52510,7 +52523,7 @@ class MouseHandler extends BaseInputHandler {
52510
52523
  const modif = event.getModifierState("Shift") || event.getModifierState("Control");
52511
52524
  (_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
52512
52525
  }
52513
- onPointerMove(event) {
52526
+ handlePointerMove(event) {
52514
52527
  var _a3;
52515
52528
  if (event.pointerType !== "mouse") return;
52516
52529
  this._canvas.focus();
@@ -52519,8 +52532,9 @@ class MouseHandler extends BaseInputHandler {
52519
52532
  this._dragHandler.onPointerMove(pos);
52520
52533
  (_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
52521
52534
  }
52522
- async _onDoubleClick(event) {
52535
+ async handleDoubleClick(event) {
52523
52536
  var _a3;
52537
+ console.log("double click!");
52524
52538
  const pos = this.relativePosition(event);
52525
52539
  (_a3 = this.onDoubleClick) == null ? void 0 : _a3.call(this, pos);
52526
52540
  event.preventDefault();
@@ -52568,13 +52582,24 @@ class CaptureStateMachine {
52568
52582
  }
52569
52583
  }
52570
52584
  }
52585
+ class DoubleClickHandler {
52586
+ constructor() {
52587
+ __publicField(this, "_lastClickTime", 0);
52588
+ __publicField(this, "_clickDelay", 300);
52589
+ }
52590
+ // Delay in milliseconds to consider a double click
52591
+ checkForDoubleClick(event) {
52592
+ const currentTime = Date.now();
52593
+ const timeDiff = currentTime - this._lastClickTime;
52594
+ this._lastClickTime = currentTime;
52595
+ return timeDiff < this._clickDelay;
52596
+ }
52597
+ }
52571
52598
  class DragHandler {
52572
- constructor(canvas, onDrag) {
52573
- __publicField(this, "_canvas");
52599
+ constructor(onDrag) {
52574
52600
  __publicField(this, "_lastDragPosition", null);
52575
52601
  __publicField(this, "_button");
52576
52602
  __publicField(this, "_onDrag");
52577
- this._canvas = canvas;
52578
52603
  this._onDrag = onDrag;
52579
52604
  }
52580
52605
  /**
@@ -52604,9 +52629,6 @@ class DragHandler {
52604
52629
  onPointerUp() {
52605
52630
  this._lastDragPosition = null;
52606
52631
  }
52607
- getCanvasSize() {
52608
- return new Vector2(this._canvas.clientWidth, this._canvas.clientHeight);
52609
- }
52610
52632
  }
52611
52633
  class TouchHandler extends BaseInputHandler {
52612
52634
  constructor(canvas) {
@@ -55511,8 +55533,8 @@ function getDefaultViewerSettings() {
55511
55533
  opacity: 0.5
55512
55534
  },
55513
55535
  ghost: {
55514
- color: new Color(5132892),
55515
- opacity: 0.01
55536
+ color: new Color(921102),
55537
+ opacity: 0.25
55516
55538
  },
55517
55539
  section: {
55518
55540
  strokeWidth: 0.01,
@@ -63693,18 +63715,11 @@ const icons = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
63693
63715
  }, Symbol.toStringTag, { value: "Module" }));
63694
63716
  function getDefaultSettings() {
63695
63717
  return {
63696
- materials: {
63697
- useGhostMaterial: true,
63698
- smallGhostThreshold: 10
63699
- },
63700
- isolation: {
63701
- enable: true
63702
- },
63703
63718
  capacity: {
63704
63719
  canFollowUrl: true,
63705
63720
  canGoFullScreen: true,
63706
- useOrthographicCamera: true,
63707
- canDownload: true
63721
+ canDownload: true,
63722
+ canReadLocalStorage: true
63708
63723
  },
63709
63724
  ui: {
63710
63725
  logo: true,
@@ -67399,7 +67414,6 @@ function AxesPanel(props) {
67399
67414
  if (empty2) return null;
67400
67415
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "vim-axes-panel-bar vc-absolute vc-top-[75%] vc-bottom-0 vc-right-0 vc-left-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "vim-axes-panel-buttons vc-absolute vc-inset-0 vc-pointer-events-auto vc-order-2 vc-flex vc-items-center vc-justify-evenly vc-bg-white", children: [
67401
67416
  whenAllTrue([
67402
- props.settings.value.capacity.useOrthographicCamera,
67403
67417
  props.settings.value.ui.orthographic
67404
67418
  ], btnOrtho),
67405
67419
  whenTrue(props.settings.value.ui.resetCamera, btnHome)
@@ -74444,7 +74458,6 @@ function applySettings(viewer, settings2) {
74444
74458
  performance2.classList.add("vc-hidden");
74445
74459
  }
74446
74460
  }
74447
- viewer.renderer.smallGhostThreshold = settings2.materials.smallGhostThreshold;
74448
74461
  }
74449
74462
  function createContainer(element) {
74450
74463
  let root = element;