copper3d 3.7.3 → 3.7.5

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.
@@ -13,6 +13,18 @@ function createShowSliceNumberDiv() {
13
13
  sliceNumberDiv.style.left = "100px";
14
14
  return sliceNumberDiv;
15
15
  }
16
+ /**
17
+ * Whether an element accepts typed input, and therefore must not have focus taken
18
+ * away from it.
19
+ */
20
+ function isEditableElement(element) {
21
+ if (!element)
22
+ return false;
23
+ const tag = element.tagName;
24
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT")
25
+ return true;
26
+ return element.isContentEditable === true;
27
+ }
16
28
  /**
17
29
  * set mouse to auto focus on the div
18
30
  * @param container the operate container div
@@ -20,6 +32,13 @@ function createShowSliceNumberDiv() {
20
32
  function autoFocusDiv(container) {
21
33
  container.tabIndex = 10;
22
34
  container.addEventListener("mouseover", () => {
35
+ // Never take focus from something the user is typing into. The container claims
36
+ // focus so its keyboard shortcuts work once the pointer is over the canvas, but
37
+ // hovering is passive: a form field anywhere else on the page would be blurred the
38
+ // moment the pointer drifted off it, which makes the field impossible to type in.
39
+ // Clicking the canvas still focuses it, so the shortcuts are unaffected.
40
+ if (isEditableElement(document.activeElement))
41
+ return;
23
42
  container.focus();
24
43
  });
25
44
  container.style.outline = "none";
@@ -1 +1 @@
1
- {"version":3,"file":"divControlTools.js","sourceRoot":"","sources":["../../../../src/Utils/segmentation/coreTools/divControlTools.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,SAAS,wBAAwB;IAC/B,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACrD,cAAc,CAAC,SAAS,GAAG,sBAAsB,CAAC;IAClD,cAAc,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;IAC3C,cAAc,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;IACpC,cAAc,CAAC,KAAK,CAAC,GAAG,GAAG,MAA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,CAAC,OAAO,GAAG,MAAM,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,MAA4B;IAClD,IAAI,cAAc,GAChB,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,aAAa,GAA6B,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC1E,aAAa,CAAC,IAAI,GAAG,EAAE,CAAC;IACxB,aAAa,CAAC,MAAM,GAAG,QAAQ,CAAC;IAChC,aAAa,CAAC,QAAQ,GAAG,SAAS,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,iBAAiB,EAAE,CAAC;IAC7E,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,CAC3C,IAAI,CACuB,CAAC;IAC9B,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;IAC1C,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;IAE5C,WAAW,CAAC,SAAS,CACnB,MAAM,CAAC,aAAa,EACpB,CAAC,EACD,CAAC,EACD,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,YAAY,CACpB,CAAC;IACF,aAAa,CAAC,IAAI,GAAG,cAAc,CAAC,SAAS,EAAE,CAAC;IAChD,aAAa,CAAC,KAAK,EAAE,CAAC;IAEtB,qCAAqC;IACrC,cAAc,GAAG,IAAI,CAAC;IACtB,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -97747,6 +97747,18 @@ function createShowSliceNumberDiv() {
97747
97747
  sliceNumberDiv.style.left = "100px";
97748
97748
  return sliceNumberDiv;
97749
97749
  }
97750
+ /**
97751
+ * Whether an element accepts typed input, and therefore must not have focus taken
97752
+ * away from it.
97753
+ */
97754
+ function isEditableElement(element) {
97755
+ if (!element)
97756
+ return false;
97757
+ const tag = element.tagName;
97758
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT")
97759
+ return true;
97760
+ return element.isContentEditable === true;
97761
+ }
97750
97762
  /**
97751
97763
  * set mouse to auto focus on the div
97752
97764
  * @param container the operate container div
@@ -97754,6 +97766,13 @@ function createShowSliceNumberDiv() {
97754
97766
  function autoFocusDiv(container) {
97755
97767
  container.tabIndex = 10;
97756
97768
  container.addEventListener("mouseover", () => {
97769
+ // Never take focus from something the user is typing into. The container claims
97770
+ // focus so its keyboard shortcuts work once the pointer is over the canvas, but
97771
+ // hovering is passive: a form field anywhere else on the page would be blurred the
97772
+ // moment the pointer drifted off it, which makes the field impossible to type in.
97773
+ // Clicking the canvas still focuses it, so the shortcuts are unaffected.
97774
+ if (isEditableElement(document.activeElement))
97775
+ return;
97757
97776
  container.focus();
97758
97777
  });
97759
97778
  container.style.outline = "none";
@@ -105337,15 +105356,15 @@ function evaluateElement(element, weights) {
105337
105356
  }
105338
105357
 
105339
105358
  // import * as kiwrious from "copper3d_plugin_heart_k";
105340
- // "v3.7.3" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
105359
+ // "v3.7.5" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
105341
105360
  // When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
105342
105361
  // referencing it throws a ReferenceError — guard it so local loading still works.
105343
105362
  let _revision = "unknown";
105344
105363
  try {
105345
- _revision = "v3.7.3";
105364
+ _revision = "v3.7.5";
105346
105365
  }
105347
105366
  catch (_a) {
105348
- /* "v3.7.3" not injected (local source build) */
105367
+ /* "v3.7.5" not injected (local source build) */
105349
105368
  }
105350
105369
  const REVISION = _revision;
105351
105370
  // Expose on global so the version can be read in a production browser console via window.__COPPER3D_VERSION__
@@ -97755,6 +97755,18 @@ void main() {
97755
97755
  sliceNumberDiv.style.left = "100px";
97756
97756
  return sliceNumberDiv;
97757
97757
  }
97758
+ /**
97759
+ * Whether an element accepts typed input, and therefore must not have focus taken
97760
+ * away from it.
97761
+ */
97762
+ function isEditableElement(element) {
97763
+ if (!element)
97764
+ return false;
97765
+ const tag = element.tagName;
97766
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT")
97767
+ return true;
97768
+ return element.isContentEditable === true;
97769
+ }
97758
97770
  /**
97759
97771
  * set mouse to auto focus on the div
97760
97772
  * @param container the operate container div
@@ -97762,6 +97774,13 @@ void main() {
97762
97774
  function autoFocusDiv(container) {
97763
97775
  container.tabIndex = 10;
97764
97776
  container.addEventListener("mouseover", () => {
97777
+ // Never take focus from something the user is typing into. The container claims
97778
+ // focus so its keyboard shortcuts work once the pointer is over the canvas, but
97779
+ // hovering is passive: a form field anywhere else on the page would be blurred the
97780
+ // moment the pointer drifted off it, which makes the field impossible to type in.
97781
+ // Clicking the canvas still focuses it, so the shortcuts are unaffected.
97782
+ if (isEditableElement(document.activeElement))
97783
+ return;
97765
97784
  container.focus();
97766
97785
  });
97767
97786
  container.style.outline = "none";
@@ -105345,15 +105364,15 @@ void main() {
105345
105364
  }
105346
105365
 
105347
105366
  // import * as kiwrious from "copper3d_plugin_heart_k";
105348
- // "v3.7.3" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
105367
+ // "v3.7.5" is injected at build time by rollup @rollup/plugin-replace, sourced from package.json version.
105349
105368
  // When copper3d is consumed from local source (no rollup replace step), the identifier is undefined and
105350
105369
  // referencing it throws a ReferenceError — guard it so local loading still works.
105351
105370
  let _revision = "unknown";
105352
105371
  try {
105353
- _revision = "v3.7.3";
105372
+ _revision = "v3.7.5";
105354
105373
  }
105355
105374
  catch (_a) {
105356
- /* "v3.7.3" not injected (local source build) */
105375
+ /* "v3.7.5" not injected (local source build) */
105357
105376
  }
105358
105377
  const REVISION = _revision;
105359
105378
  // Expose on global so the version can be read in a production browser console via window.__COPPER3D_VERSION__
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "copper3d",
3
3
  "description": "A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.",
4
- "version": "3.7.3",
4
+ "version": "3.7.5",
5
5
  "main": "dist/bundle.umd.js",
6
6
  "moudle": "dist/bundle.esm.js",
7
7
  "types": "dist/types/index.d.ts",