@lv-x-software-house/x_view 1.2.6-dev.45 → 1.2.6-dev.46

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/index.js CHANGED
@@ -14403,7 +14403,8 @@ function XViewScene({
14403
14403
  maxAncestryRenderIndex: 0,
14404
14404
  lastRenderedAncestryId: null,
14405
14405
  lastDescriptionLength: 0,
14406
- highlightedNodeId: null
14406
+ highlightedNodeId: null,
14407
+ keysPressed: {}
14407
14408
  });
14408
14409
  const maxReadPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
14409
14410
  const {
@@ -15898,14 +15899,14 @@ function XViewScene({
15898
15899
  node.position.y += Math.sin(clock.getElapsedTime() * 0.5 + i) * 5e-3;
15899
15900
  const isImageNode = node.userData.useImageAsTexture === true || String(node.userData.useImageAsTexture) === "true";
15900
15901
  if (isImageNode) {
15901
- node.quaternion.copy(camera.quaternion);
15902
+ node.quaternion.copy(camera2.quaternion);
15902
15903
  }
15903
15904
  });
15904
15905
  } else {
15905
15906
  stateRef.current.clickableNodes.forEach((node) => {
15906
15907
  const isImageNode = node.userData.useImageAsTexture === true || String(node.userData.useImageAsTexture) === "true";
15907
15908
  if (isImageNode) {
15908
- node.quaternion.copy(camera.quaternion);
15909
+ node.quaternion.copy(camera2.quaternion);
15909
15910
  }
15910
15911
  });
15911
15912
  }
@@ -15975,8 +15976,8 @@ function XViewScene({
15975
15976
  const srcMesh = stateRef.current.nodeObjects[String(connection.sourceNodeData.id)];
15976
15977
  if (srcMesh) {
15977
15978
  const raycaster2 = new THREE3.Raycaster();
15978
- raycaster2.setFromCamera(mouse, camera);
15979
- camera.getWorldDirection(plane.normal);
15979
+ raycaster2.setFromCamera(mouse, camera2);
15980
+ camera2.getWorldDirection(plane.normal);
15980
15981
  plane.setFromNormalAndCoplanarPoint(plane.normal, srcMesh.position);
15981
15982
  if (raycaster2.ray.intersectPlane(plane, intersectionPoint))
15982
15983
  connection.line.geometry.setPositions([
@@ -15989,8 +15990,8 @@ function XViewScene({
15989
15990
  const fixedMesh = stateRef.current.nodeObjects[String(relink.fixedNodeId)];
15990
15991
  if (fixedMesh) {
15991
15992
  const raycaster2 = new THREE3.Raycaster();
15992
- raycaster2.setFromCamera(mouse, camera);
15993
- camera.getWorldDirection(plane.normal);
15993
+ raycaster2.setFromCamera(mouse, camera2);
15994
+ camera2.getWorldDirection(plane.normal);
15994
15995
  plane.setFromNormalAndCoplanarPoint(plane.normal, fixedMesh.position);
15995
15996
  if (raycaster2.ray.intersectPlane(plane, intersectionPoint))
15996
15997
  relink.line.geometry.setPositions([
@@ -16013,24 +16014,46 @@ function XViewScene({
16013
16014
  tooltipEl: tooltipRef.current,
16014
16015
  hoveredNode: stateRef.current.hoveredNode,
16015
16016
  hoveredLink: stateRef.current.hoveredLink,
16016
- camera,
16017
+ camera: camera2,
16017
16018
  mountEl: currentMount,
16018
16019
  isSceneBusy: stateRef.current.isDragging || creation.isActive || connection.isActive || relink.isActive || ancestryMode.isActive,
16019
16020
  parentData: parentDataRef.current,
16020
16021
  ancestryData: ancestryDataRef.current
16021
16022
  });
16022
16023
  (_b2 = stateRef.current.tweenGroup) == null ? void 0 : _b2.update(time);
16024
+ const { keysPressed, controls: controls2, camera: camera2 } = stateRef.current;
16025
+ if (controls2 && keysPressed) {
16026
+ const panSpeed = 0.8;
16027
+ const rotateSpeed = 0.025;
16028
+ const zoomSpeed = 1.025;
16029
+ const isShift = !!keysPressed["shiftKey"];
16030
+ const isCtrl = !!keysPressed["ctrlKey"];
16031
+ if (isCtrl) {
16032
+ if (keysPressed["ArrowLeft"]) controls2._rotateLeft(rotateSpeed);
16033
+ if (keysPressed["ArrowRight"]) controls2._rotateLeft(-rotateSpeed);
16034
+ if (keysPressed["ArrowUp"]) controls2._rotateUp(rotateSpeed);
16035
+ if (keysPressed["ArrowDown"]) controls2._rotateUp(-rotateSpeed);
16036
+ } else if (isShift) {
16037
+ if (keysPressed["ArrowUp"]) controls2._dollyIn(zoomSpeed);
16038
+ if (keysPressed["ArrowDown"]) controls2._dollyOut(zoomSpeed);
16039
+ } else {
16040
+ if (keysPressed["ArrowLeft"]) controls2.panLeft(panSpeed, camera2.matrix);
16041
+ if (keysPressed["ArrowRight"]) controls2.panLeft(-panSpeed, camera2.matrix);
16042
+ if (keysPressed["ArrowUp"]) controls2.panUp(panSpeed, camera2.matrix);
16043
+ if (keysPressed["ArrowDown"]) controls2.panUp(-panSpeed, camera2.matrix);
16044
+ }
16045
+ }
16023
16046
  stateRef.current.controls.update();
16024
16047
  renderer.autoClear = false;
16025
16048
  renderer.clear();
16026
16049
  scene.background = originalBackground;
16027
- camera.layers.set(GHOST_BLOOM_LAYER);
16050
+ camera2.layers.set(GHOST_BLOOM_LAYER);
16028
16051
  composer.render();
16029
16052
  renderer.clearDepth();
16030
16053
  scene.background = null;
16031
- camera.layers.set(DEFAULT_LAYER);
16032
- renderer.render(scene, camera);
16033
- camera.layers.enableAll();
16054
+ camera2.layers.set(DEFAULT_LAYER);
16055
+ renderer.render(scene, camera2);
16056
+ camera2.layers.enableAll();
16034
16057
  }
16035
16058
  animate();
16036
16059
  function handleResize() {
@@ -18555,35 +18578,26 @@ function XViewScene({
18555
18578
  if (isArrowKey) {
18556
18579
  const isUiClear = !stateRef.current.creation.isActive && !stateRef.current.connection.isActive && !stateRef.current.relink.isActive && !stateRef.current.ancestry.isActive && !((_d2 = context.versionMode) == null ? void 0 : _d2.isActive) && !contextMenu.visible && !multiContextMenu.visible && !relationshipMenu.visible && !readingMode.isActive && !isImportModalOpen && !isBoardsOpen && !isSidebarOpen && !isMilestoneManagerOpen && !detailsNode && !detailsLink && !ancestryLinkDetails && !imageViewer.visible && !editingAncestryRel.visible && !questMode.isActive;
18557
18580
  if (isUiClear) {
18558
- const { controls } = stateRef.current;
18559
- if (controls) {
18560
- event.preventDefault();
18561
- const rotateAngle = Math.PI / 36;
18562
- const zoomScale = 1.1;
18563
- if (event.key === "ArrowLeft") {
18564
- controls._rotateLeft(rotateAngle);
18565
- } else if (event.key === "ArrowRight") {
18566
- controls._rotateLeft(-rotateAngle);
18567
- } else if (event.key === "ArrowUp") {
18568
- if (event.shiftKey) {
18569
- controls._dollyIn(zoomScale);
18570
- } else {
18571
- controls._rotateUp(rotateAngle);
18572
- }
18573
- } else if (event.key === "ArrowDown") {
18574
- if (event.shiftKey) {
18575
- controls._dollyOut(zoomScale);
18576
- } else {
18577
- controls._rotateUp(-rotateAngle);
18578
- }
18579
- }
18580
- controls.update();
18581
- }
18581
+ event.preventDefault();
18582
+ stateRef.current.keysPressed[event.key] = true;
18583
+ stateRef.current.keysPressed["shiftKey"] = event.shiftKey;
18584
+ stateRef.current.keysPressed["ctrlKey"] = event.ctrlKey || event.metaKey;
18582
18585
  }
18583
18586
  }
18584
18587
  }
18588
+ function handleKeyUp(event) {
18589
+ if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(event.key)) {
18590
+ stateRef.current.keysPressed[event.key] = false;
18591
+ }
18592
+ stateRef.current.keysPressed["shiftKey"] = event.shiftKey;
18593
+ stateRef.current.keysPressed["ctrlKey"] = event.ctrlKey || event.metaKey;
18594
+ }
18585
18595
  window.addEventListener("keydown", handleKeyDown);
18586
- return () => window.removeEventListener("keydown", handleKeyDown);
18596
+ window.addEventListener("keyup", handleKeyUp);
18597
+ return () => {
18598
+ window.removeEventListener("keydown", handleKeyDown);
18599
+ window.removeEventListener("keyup", handleKeyUp);
18600
+ };
18587
18601
  }, [
18588
18602
  contextMenu.visible,
18589
18603
  multiContextMenu.visible,
package/dist/index.mjs CHANGED
@@ -14459,7 +14459,8 @@ function XViewScene({
14459
14459
  maxAncestryRenderIndex: 0,
14460
14460
  lastRenderedAncestryId: null,
14461
14461
  lastDescriptionLength: 0,
14462
- highlightedNodeId: null
14462
+ highlightedNodeId: null,
14463
+ keysPressed: {}
14463
14464
  });
14464
14465
  const maxReadPanelW = typeof window !== "undefined" ? window.innerWidth * 0.92 : 1200;
14465
14466
  const {
@@ -15954,14 +15955,14 @@ function XViewScene({
15954
15955
  node.position.y += Math.sin(clock.getElapsedTime() * 0.5 + i) * 5e-3;
15955
15956
  const isImageNode = node.userData.useImageAsTexture === true || String(node.userData.useImageAsTexture) === "true";
15956
15957
  if (isImageNode) {
15957
- node.quaternion.copy(camera.quaternion);
15958
+ node.quaternion.copy(camera2.quaternion);
15958
15959
  }
15959
15960
  });
15960
15961
  } else {
15961
15962
  stateRef.current.clickableNodes.forEach((node) => {
15962
15963
  const isImageNode = node.userData.useImageAsTexture === true || String(node.userData.useImageAsTexture) === "true";
15963
15964
  if (isImageNode) {
15964
- node.quaternion.copy(camera.quaternion);
15965
+ node.quaternion.copy(camera2.quaternion);
15965
15966
  }
15966
15967
  });
15967
15968
  }
@@ -16031,8 +16032,8 @@ function XViewScene({
16031
16032
  const srcMesh = stateRef.current.nodeObjects[String(connection.sourceNodeData.id)];
16032
16033
  if (srcMesh) {
16033
16034
  const raycaster2 = new THREE3.Raycaster();
16034
- raycaster2.setFromCamera(mouse, camera);
16035
- camera.getWorldDirection(plane.normal);
16035
+ raycaster2.setFromCamera(mouse, camera2);
16036
+ camera2.getWorldDirection(plane.normal);
16036
16037
  plane.setFromNormalAndCoplanarPoint(plane.normal, srcMesh.position);
16037
16038
  if (raycaster2.ray.intersectPlane(plane, intersectionPoint))
16038
16039
  connection.line.geometry.setPositions([
@@ -16045,8 +16046,8 @@ function XViewScene({
16045
16046
  const fixedMesh = stateRef.current.nodeObjects[String(relink.fixedNodeId)];
16046
16047
  if (fixedMesh) {
16047
16048
  const raycaster2 = new THREE3.Raycaster();
16048
- raycaster2.setFromCamera(mouse, camera);
16049
- camera.getWorldDirection(plane.normal);
16049
+ raycaster2.setFromCamera(mouse, camera2);
16050
+ camera2.getWorldDirection(plane.normal);
16050
16051
  plane.setFromNormalAndCoplanarPoint(plane.normal, fixedMesh.position);
16051
16052
  if (raycaster2.ray.intersectPlane(plane, intersectionPoint))
16052
16053
  relink.line.geometry.setPositions([
@@ -16069,24 +16070,46 @@ function XViewScene({
16069
16070
  tooltipEl: tooltipRef.current,
16070
16071
  hoveredNode: stateRef.current.hoveredNode,
16071
16072
  hoveredLink: stateRef.current.hoveredLink,
16072
- camera,
16073
+ camera: camera2,
16073
16074
  mountEl: currentMount,
16074
16075
  isSceneBusy: stateRef.current.isDragging || creation.isActive || connection.isActive || relink.isActive || ancestryMode.isActive,
16075
16076
  parentData: parentDataRef.current,
16076
16077
  ancestryData: ancestryDataRef.current
16077
16078
  });
16078
16079
  (_b2 = stateRef.current.tweenGroup) == null ? void 0 : _b2.update(time);
16080
+ const { keysPressed, controls: controls2, camera: camera2 } = stateRef.current;
16081
+ if (controls2 && keysPressed) {
16082
+ const panSpeed = 0.8;
16083
+ const rotateSpeed = 0.025;
16084
+ const zoomSpeed = 1.025;
16085
+ const isShift = !!keysPressed["shiftKey"];
16086
+ const isCtrl = !!keysPressed["ctrlKey"];
16087
+ if (isCtrl) {
16088
+ if (keysPressed["ArrowLeft"]) controls2._rotateLeft(rotateSpeed);
16089
+ if (keysPressed["ArrowRight"]) controls2._rotateLeft(-rotateSpeed);
16090
+ if (keysPressed["ArrowUp"]) controls2._rotateUp(rotateSpeed);
16091
+ if (keysPressed["ArrowDown"]) controls2._rotateUp(-rotateSpeed);
16092
+ } else if (isShift) {
16093
+ if (keysPressed["ArrowUp"]) controls2._dollyIn(zoomSpeed);
16094
+ if (keysPressed["ArrowDown"]) controls2._dollyOut(zoomSpeed);
16095
+ } else {
16096
+ if (keysPressed["ArrowLeft"]) controls2.panLeft(panSpeed, camera2.matrix);
16097
+ if (keysPressed["ArrowRight"]) controls2.panLeft(-panSpeed, camera2.matrix);
16098
+ if (keysPressed["ArrowUp"]) controls2.panUp(panSpeed, camera2.matrix);
16099
+ if (keysPressed["ArrowDown"]) controls2.panUp(-panSpeed, camera2.matrix);
16100
+ }
16101
+ }
16079
16102
  stateRef.current.controls.update();
16080
16103
  renderer.autoClear = false;
16081
16104
  renderer.clear();
16082
16105
  scene.background = originalBackground;
16083
- camera.layers.set(GHOST_BLOOM_LAYER);
16106
+ camera2.layers.set(GHOST_BLOOM_LAYER);
16084
16107
  composer.render();
16085
16108
  renderer.clearDepth();
16086
16109
  scene.background = null;
16087
- camera.layers.set(DEFAULT_LAYER);
16088
- renderer.render(scene, camera);
16089
- camera.layers.enableAll();
16110
+ camera2.layers.set(DEFAULT_LAYER);
16111
+ renderer.render(scene, camera2);
16112
+ camera2.layers.enableAll();
16090
16113
  }
16091
16114
  animate();
16092
16115
  function handleResize() {
@@ -18611,35 +18634,26 @@ function XViewScene({
18611
18634
  if (isArrowKey) {
18612
18635
  const isUiClear = !stateRef.current.creation.isActive && !stateRef.current.connection.isActive && !stateRef.current.relink.isActive && !stateRef.current.ancestry.isActive && !((_d2 = context.versionMode) == null ? void 0 : _d2.isActive) && !contextMenu.visible && !multiContextMenu.visible && !relationshipMenu.visible && !readingMode.isActive && !isImportModalOpen && !isBoardsOpen && !isSidebarOpen && !isMilestoneManagerOpen && !detailsNode && !detailsLink && !ancestryLinkDetails && !imageViewer.visible && !editingAncestryRel.visible && !questMode.isActive;
18613
18636
  if (isUiClear) {
18614
- const { controls } = stateRef.current;
18615
- if (controls) {
18616
- event.preventDefault();
18617
- const rotateAngle = Math.PI / 36;
18618
- const zoomScale = 1.1;
18619
- if (event.key === "ArrowLeft") {
18620
- controls._rotateLeft(rotateAngle);
18621
- } else if (event.key === "ArrowRight") {
18622
- controls._rotateLeft(-rotateAngle);
18623
- } else if (event.key === "ArrowUp") {
18624
- if (event.shiftKey) {
18625
- controls._dollyIn(zoomScale);
18626
- } else {
18627
- controls._rotateUp(rotateAngle);
18628
- }
18629
- } else if (event.key === "ArrowDown") {
18630
- if (event.shiftKey) {
18631
- controls._dollyOut(zoomScale);
18632
- } else {
18633
- controls._rotateUp(-rotateAngle);
18634
- }
18635
- }
18636
- controls.update();
18637
- }
18637
+ event.preventDefault();
18638
+ stateRef.current.keysPressed[event.key] = true;
18639
+ stateRef.current.keysPressed["shiftKey"] = event.shiftKey;
18640
+ stateRef.current.keysPressed["ctrlKey"] = event.ctrlKey || event.metaKey;
18638
18641
  }
18639
18642
  }
18640
18643
  }
18644
+ function handleKeyUp(event) {
18645
+ if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(event.key)) {
18646
+ stateRef.current.keysPressed[event.key] = false;
18647
+ }
18648
+ stateRef.current.keysPressed["shiftKey"] = event.shiftKey;
18649
+ stateRef.current.keysPressed["ctrlKey"] = event.ctrlKey || event.metaKey;
18650
+ }
18641
18651
  window.addEventListener("keydown", handleKeyDown);
18642
- return () => window.removeEventListener("keydown", handleKeyDown);
18652
+ window.addEventListener("keyup", handleKeyUp);
18653
+ return () => {
18654
+ window.removeEventListener("keydown", handleKeyDown);
18655
+ window.removeEventListener("keyup", handleKeyUp);
18656
+ };
18643
18657
  }, [
18644
18658
  contextMenu.visible,
18645
18659
  multiContextMenu.visible,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv-x-software-house/x_view",
3
- "version": "1.2.6-dev.45",
3
+ "version": "1.2.6-dev.46",
4
4
  "description": "Pacote privado contendo os componentes e lógica de renderização 3D do X View.",
5
5
  "author": "iv.x - Engenharia de Software - ivxsoftwarehouse@gmail.com",
6
6
  "license": "UNLICENSED",