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.
@@ -5,6 +5,7 @@ export declare class MouseHandler extends BaseInputHandler {
5
5
  private _lastMouseDownPosition;
6
6
  private _capture;
7
7
  private _dragHandler;
8
+ private _doubleClickHandler;
8
9
  onButtonDown: (pos: THREE.Vector2, button: number) => void;
9
10
  onButtonUp: (pos: THREE.Vector2, button: number) => void;
10
11
  onMouseMove: (event: THREE.Vector2) => void;
@@ -15,11 +16,11 @@ export declare class MouseHandler extends BaseInputHandler {
15
16
  constructor(canvas: HTMLCanvasElement);
16
17
  protected addListeners(): void;
17
18
  dispose(): void;
18
- private onPointerDown;
19
- private onPointerUp;
19
+ private handlePointerDown;
20
+ private handlePointerUp;
20
21
  private handleMouseClick;
21
- private onPointerMove;
22
- private _onDoubleClick;
22
+ private handlePointerMove;
23
+ private handleDoubleClick;
23
24
  private onMouseScroll;
24
25
  private relativePosition;
25
26
  }
@@ -16,18 +16,11 @@ export type RecursivePartial<T> = {
16
16
  * @interface Settings
17
17
  */
18
18
  export type Settings = {
19
- materials: {
20
- useGhostMaterial: boolean;
21
- smallGhostThreshold: number;
22
- };
23
- isolation: {
24
- enable: boolean;
25
- };
26
19
  capacity: {
27
20
  canFollowUrl: boolean;
28
21
  canGoFullScreen: boolean;
29
- useOrthographicCamera: boolean;
30
22
  canDownload: boolean;
23
+ canReadLocalStorage: boolean;
31
24
  };
32
25
  ui: {
33
26
  logo: UserBoolean;
@@ -47905,10 +47905,16 @@ void main() {
47905
47905
  },
47906
47906
  uniforms: {
47907
47907
  // Uniform controlling the overall transparency of the non-visible objects.
47908
- opacity: { value: 1e-3 },
47908
+ opacity: { value: 0.25 },
47909
47909
  // Uniform specifying the fill color for non-visible objects.
47910
- fillColor: { value: new Vector3(0, 0, 0) }
47910
+ fillColor: { value: new Vector3(14 / 255, 14 / 255, 14 / 255) }
47911
47911
  },
47912
+ /*
47913
+ blending: THREE.CustomBlending,
47914
+ blendSrc: THREE.SrcAlphaFactor,
47915
+ blendEquation: THREE.AddEquation,
47916
+ blendDst: THREE.OneMinusDstColorFactor,
47917
+ */
47912
47918
  // Render only the front side of faces to prevent drawing internal geometry.
47913
47919
  side: FrontSide,
47914
47920
  // Enable support for vertex colors.
@@ -47958,7 +47964,8 @@ void main() {
47958
47964
  // Handle clipping planes to discard fragments outside the defined planes.
47959
47965
  #include <clipping_planes_fragment>
47960
47966
  // Set the fragment color to the specified fill color and opacity.
47961
- gl_FragColor = vec4(fillColor, opacity);
47967
+ // Divided by 10 just to match Ultra ghost opacity at 0.25
47968
+ gl_FragColor = vec4(fillColor, opacity / 10.0);
47962
47969
  }
47963
47970
  `
47964
47971
  )
@@ -52464,6 +52471,7 @@ void main() {
52464
52471
  __publicField(this, "_lastMouseDownPosition", new Vector2(0, 0));
52465
52472
  __publicField(this, "_capture");
52466
52473
  __publicField(this, "_dragHandler");
52474
+ __publicField(this, "_doubleClickHandler", new DoubleClickHandler());
52467
52475
  __publicField(this, "onButtonDown");
52468
52476
  __publicField(this, "onButtonUp");
52469
52477
  __publicField(this, "onMouseMove");
@@ -52473,29 +52481,29 @@ void main() {
52473
52481
  __publicField(this, "onDoubleClick");
52474
52482
  __publicField(this, "onWheel");
52475
52483
  this._capture = new CaptureStateMachine(canvas);
52476
- this._dragHandler = new DragHandler(canvas, (delta, button) => this.onDrag(delta, button));
52484
+ this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
52477
52485
  }
52478
52486
  addListeners() {
52479
52487
  this.reg(this._canvas, "pointerdown", (e) => {
52480
- this.onPointerDown(e);
52488
+ this.handlePointerDown(e);
52481
52489
  });
52482
52490
  this.reg(this._canvas, "pointerup", (e) => {
52483
- this.onPointerUp(e);
52491
+ this.handlePointerUp(e);
52484
52492
  });
52485
52493
  this.reg(this._canvas, "pointermove", (e) => {
52486
- this.onPointerMove(e);
52494
+ this.handlePointerMove(e);
52487
52495
  });
52488
52496
  this.reg(this._canvas, "wheel", (e) => {
52489
52497
  this.onMouseScroll(e);
52490
52498
  });
52491
52499
  this.reg(this._canvas, "dblclick", (e) => {
52492
- this._onDoubleClick(e);
52500
+ this.handleDoubleClick(e);
52493
52501
  });
52494
52502
  }
52495
52503
  dispose() {
52496
52504
  this.unregister();
52497
52505
  }
52498
- onPointerDown(event) {
52506
+ handlePointerDown(event) {
52499
52507
  var _a3;
52500
52508
  if (event.pointerType !== "mouse") return;
52501
52509
  const pos = this.relativePosition(event);
@@ -52505,20 +52513,25 @@ void main() {
52505
52513
  this._capture.onPointerDown(event);
52506
52514
  event.preventDefault();
52507
52515
  }
52508
- onPointerUp(event) {
52516
+ handlePointerUp(event) {
52509
52517
  var _a3;
52510
52518
  if (event.pointerType !== "mouse") return;
52511
52519
  const pos = this.relativePosition(event);
52512
52520
  (_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
52513
- this.handleMouseClick(event);
52514
52521
  this._capture.onPointerUp(event);
52515
52522
  this._dragHandler.onPointerUp();
52523
+ if (this._doubleClickHandler.checkForDoubleClick(event)) {
52524
+ this.handleDoubleClick(event);
52525
+ } else {
52526
+ this.handleMouseClick(event);
52527
+ }
52516
52528
  event.preventDefault();
52517
52529
  }
52518
52530
  async handleMouseClick(event) {
52519
52531
  var _a3;
52520
52532
  if (event.pointerType !== "mouse") return;
52521
52533
  if (event.button !== 0) return;
52534
+ console.log("click!");
52522
52535
  const pos = this.relativePosition(event);
52523
52536
  if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
52524
52537
  return;
@@ -52526,7 +52539,7 @@ void main() {
52526
52539
  const modif = event.getModifierState("Shift") || event.getModifierState("Control");
52527
52540
  (_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
52528
52541
  }
52529
- onPointerMove(event) {
52542
+ handlePointerMove(event) {
52530
52543
  var _a3;
52531
52544
  if (event.pointerType !== "mouse") return;
52532
52545
  this._canvas.focus();
@@ -52535,8 +52548,9 @@ void main() {
52535
52548
  this._dragHandler.onPointerMove(pos);
52536
52549
  (_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
52537
52550
  }
52538
- async _onDoubleClick(event) {
52551
+ async handleDoubleClick(event) {
52539
52552
  var _a3;
52553
+ console.log("double click!");
52540
52554
  const pos = this.relativePosition(event);
52541
52555
  (_a3 = this.onDoubleClick) == null ? void 0 : _a3.call(this, pos);
52542
52556
  event.preventDefault();
@@ -52584,13 +52598,24 @@ void main() {
52584
52598
  }
52585
52599
  }
52586
52600
  }
52601
+ class DoubleClickHandler {
52602
+ constructor() {
52603
+ __publicField(this, "_lastClickTime", 0);
52604
+ __publicField(this, "_clickDelay", 300);
52605
+ }
52606
+ // Delay in milliseconds to consider a double click
52607
+ checkForDoubleClick(event) {
52608
+ const currentTime = Date.now();
52609
+ const timeDiff = currentTime - this._lastClickTime;
52610
+ this._lastClickTime = currentTime;
52611
+ return timeDiff < this._clickDelay;
52612
+ }
52613
+ }
52587
52614
  class DragHandler {
52588
- constructor(canvas, onDrag) {
52589
- __publicField(this, "_canvas");
52615
+ constructor(onDrag) {
52590
52616
  __publicField(this, "_lastDragPosition", null);
52591
52617
  __publicField(this, "_button");
52592
52618
  __publicField(this, "_onDrag");
52593
- this._canvas = canvas;
52594
52619
  this._onDrag = onDrag;
52595
52620
  }
52596
52621
  /**
@@ -52620,9 +52645,6 @@ void main() {
52620
52645
  onPointerUp() {
52621
52646
  this._lastDragPosition = null;
52622
52647
  }
52623
- getCanvasSize() {
52624
- return new Vector2(this._canvas.clientWidth, this._canvas.clientHeight);
52625
- }
52626
52648
  }
52627
52649
  class TouchHandler extends BaseInputHandler {
52628
52650
  constructor(canvas) {
@@ -55527,8 +55549,8 @@ void main() {
55527
55549
  opacity: 0.5
55528
55550
  },
55529
55551
  ghost: {
55530
- color: new Color(5132892),
55531
- opacity: 0.01
55552
+ color: new Color(921102),
55553
+ opacity: 0.25
55532
55554
  },
55533
55555
  section: {
55534
55556
  strokeWidth: 0.01,
@@ -63709,18 +63731,11 @@ Averrage Date/Second ${avgDataRatePS} kb
63709
63731
  }, Symbol.toStringTag, { value: "Module" }));
63710
63732
  function getDefaultSettings() {
63711
63733
  return {
63712
- materials: {
63713
- useGhostMaterial: true,
63714
- smallGhostThreshold: 10
63715
- },
63716
- isolation: {
63717
- enable: true
63718
- },
63719
63734
  capacity: {
63720
63735
  canFollowUrl: true,
63721
63736
  canGoFullScreen: true,
63722
- useOrthographicCamera: true,
63723
- canDownload: true
63737
+ canDownload: true,
63738
+ canReadLocalStorage: true
63724
63739
  },
63725
63740
  ui: {
63726
63741
  logo: true,
@@ -67415,7 +67430,6 @@ Averrage Date/Second ${avgDataRatePS} kb
67415
67430
  if (empty2) return null;
67416
67431
  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: [
67417
67432
  whenAllTrue([
67418
- props.settings.value.capacity.useOrthographicCamera,
67419
67433
  props.settings.value.ui.orthographic
67420
67434
  ], btnOrtho),
67421
67435
  whenTrue(props.settings.value.ui.resetCamera, btnHome)
@@ -74460,7 +74474,6 @@ Averrage Date/Second ${avgDataRatePS} kb
74460
74474
  performance2.classList.add("vc-hidden");
74461
74475
  }
74462
74476
  }
74463
- viewer.renderer.smallGhostThreshold = settings2.materials.smallGhostThreshold;
74464
74477
  }
74465
74478
  function createContainer(element) {
74466
74479
  let root = element;