@sienci/gviewer 0.1.12 → 0.1.13
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/{GCodeSVGRenderer-Cp6DZxKA.cjs → GCodeSVGRenderer-8mX-XL8F.cjs} +2 -2
- package/dist/{GCodeSVGRenderer-BwCewdRn.js → GCodeSVGRenderer-CCA3LUSq.js} +6 -2
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/types/viewer/toolpath/streams.d.ts +3 -0
- package/dist/viewer.cjs +1 -1
- package/dist/viewer.js +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,8 @@ function hP(r) {
|
|
|
27
27
|
totalVertices: t,
|
|
28
28
|
greyCursorVertex: 0,
|
|
29
29
|
kind: A.kind,
|
|
30
|
-
cutBucketIndex: A.cutBucketIndex
|
|
30
|
+
cutBucketIndex: A.cutBucketIndex,
|
|
31
|
+
workerColors: A.colors ? P : void 0
|
|
31
32
|
}), i.boundingBox && (B = B ? B.union(i.boundingBox) : i.boundingBox.clone());
|
|
32
33
|
}
|
|
33
34
|
return { streams: Q, bounds: B };
|
|
@@ -38,6 +39,7 @@ function kP(r, Q) {
|
|
|
38
39
|
}
|
|
39
40
|
function lP(r, Q) {
|
|
40
41
|
for (const B of r) {
|
|
42
|
+
if (B.workerColors) continue;
|
|
41
43
|
const A = ot(B.kind, B.totalVertices, Q);
|
|
42
44
|
B.baseColors = A, B.simColors.set(A), B.greyCursorVertex = 0;
|
|
43
45
|
const t = B.line.geometry.getAttribute("color");
|
|
@@ -3009,10 +3011,12 @@ class Hi {
|
|
|
3009
3011
|
this.setToolpathGeometry({
|
|
3010
3012
|
rapid: {
|
|
3011
3013
|
positions: B.positions,
|
|
3014
|
+
colors: B.colors,
|
|
3012
3015
|
prefixEndVertex: B.prefixEndVertex
|
|
3013
3016
|
},
|
|
3014
3017
|
cuts: [{
|
|
3015
3018
|
positions: A.positions,
|
|
3019
|
+
colors: A.colors,
|
|
3016
3020
|
prefixEndVertex: A.prefixEndVertex
|
|
3017
3021
|
}],
|
|
3018
3022
|
cutBucketCount: 1
|
|
@@ -3502,7 +3506,7 @@ class ji {
|
|
|
3502
3506
|
loadFromWorkerData(Q) {
|
|
3503
3507
|
const B = EP(Q);
|
|
3504
3508
|
if (this.workerMode = !0, this.rapidVerts = new Float32Array(0), this.cutVerts = new Float32Array(0), this.segmentGroups = B.map((A) => ({
|
|
3505
|
-
color: A.
|
|
3509
|
+
color: A.hexColor,
|
|
3506
3510
|
opacity: A.opacity,
|
|
3507
3511
|
verts: A.positions
|
|
3508
3512
|
})), this.bounds = BA(...B.map((A) => A.positions)), !this.bounds.empty) {
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),V=require("./GCodeSVGRenderer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),V=require("./GCodeSVGRenderer-8mX-XL8F.cjs");function w(a){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(u,s,i.get?i:{enumerable:!0,get:()=>a[s]})}}return u.default=a,Object.freeze(u)}const o=w(F),G=o.forwardRef(function(u,s){const{id:i,options:l,callbacks:c,className:m,style:f}=u,d=o.useRef(null),r=o.useRef(null);return o.useEffect(()=>{const e=d.current;if(!e)return;const p=new V.GCodeViewer({id:i,container:e,options:l,callbacks:c});return r.current=p,()=>{r.current=null,p.dispose()}},[i]),o.useEffect(()=>{var e;(e=r.current)==null||e.setOptions(l??{})},[l]),o.useEffect(()=>{var e;(e=r.current)==null||e.setCallbacks(c??{})},[c]),o.useImperativeHandle(s,()=>{const e=()=>{const t=r.current;if(!t)throw new Error("GCodeViewer is not ready.");return t};return{get id(){return i},setCallbacks(t){e().setCallbacks(t)},snapCameraToView(t,n){e().snapCameraToView(t,n)},setBitPosition(t,n){e().setBitPosition(t,n)},setBitVisible(t){e().setBitVisible(t)},setBitSpinning(t){e().setBitSpinning(t)},setToolpathRotationA(t){e().setToolpathRotationA(t)},hideUntilLine(t,n){e().hideUntilLine(t,n)},seekToLine(t,n){e().seekToLine(t,n)},showAll(){e().showAll()},resetColors(){e().resetColors()},loadFromUrl(t,n){return e().loadFromUrl(t,n)},loadFromFile(t){return e().loadFromFile(t)},loadFromText(t){return e().loadFromText(t)},loadFromLines(t){return e().loadFromLines(t)},loadFromWorkerData(t){return e().loadFromWorkerData(t)},unload(){e().unload()},setOptions(t){e().setOptions(t)},getOptions(){return e().getOptions()},resize(){e().resize()},focusToModel(){e().focusToModel()},resetCamera(){e().resetCamera()},getBounds(){return e().getBounds()},dispose(){e().dispose()}}},[i]),o.createElement("div",{ref:d,className:m,style:f})}),C=o.forwardRef(function(u,s){const{id:i,options:l,className:c,style:m}=u,f=o.useRef(null),d=o.useRef(null);return o.useEffect(()=>{const r=f.current;if(!r)return;const e=new V.GCodeSVGRenderer(r,l);return d.current=e,()=>{d.current=null,e.dispose()}},[]),o.useEffect(()=>{var r;l&&((r=d.current)==null||r.setOptions(l))},[l]),o.useImperativeHandle(s,()=>{const r=()=>{const e=d.current;if(!e)throw new Error("GCodeSVGRenderer is not ready.");return e};return{loadFromLines:e=>r().loadFromLines(e),loadFromFile:e=>r().loadFromFile(e),loadFromText:e=>r().loadFromText(e),loadFromWorkerData:e=>r().loadFromWorkerData(e),loadFromPrecomputedGroups:e=>r().loadFromPrecomputedGroups(e),clear:()=>r().clear(),resetView:()=>r().resetView(),setOptions:e=>r().setOptions(e),setProjectionMode:e=>r().setProjectionMode(e),setBitPosition:e=>r().setBitPosition(e),setBitVisible:e=>r().setBitVisible(e),getSVGElement:()=>r().getSVGElement(),dispose:()=>r().dispose()}},[]),o.createElement("div",{ref:f,className:c,style:{width:"100%",height:"100%",...m}})});exports.GCodeSVGVisualizer=C;exports.GCodeVisualizer=G;
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as o from "react";
|
|
2
|
-
import { a as F, G as w } from "./GCodeSVGRenderer-
|
|
2
|
+
import { a as F, G as w } from "./GCodeSVGRenderer-CCA3LUSq.js";
|
|
3
3
|
const C = o.forwardRef(
|
|
4
4
|
function(u, c) {
|
|
5
5
|
const { id: a, options: n, callbacks: l, className: m, style: d } = u, i = o.useRef(null), t = o.useRef(null);
|
|
@@ -10,6 +10,9 @@ export type ToolpathStreamState = {
|
|
|
10
10
|
greyCursorVertex: number;
|
|
11
11
|
kind: ToolpathStreamKind;
|
|
12
12
|
cutBucketIndex: number | null;
|
|
13
|
+
/** Set when colors came from the worker's pre-baked colorArrayBuffer (e.g. toolchange palette).
|
|
14
|
+
* refreshToolpathStreamColors skips these streams so theme changes don't flatten per-tool colors. */
|
|
15
|
+
workerColors?: Float32Array;
|
|
13
16
|
};
|
|
14
17
|
export type ToolpathStreamSpec = {
|
|
15
18
|
kind: ToolpathStreamKind;
|
package/dist/viewer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GCodeSVGRenderer-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./GCodeSVGRenderer-8mX-XL8F.cjs"),a={dark:{background:"#111827",opacity:.9,rapidOpacity:.3,colors:{rapid:"#0ef6ae",cutting:"#3e85c7",laser:"#a855f7",processed:"#6b7280",boundingBox:"#77a9d7",grid:{major:"#77a9d7",minor:"#3e6e9e"},axes:{x:"#df3b3b",y:"#06b881",z:"#295d8d"}}},light:{background:"#e5e7eb",opacity:.9,rapidOpacity:.3,colors:{rapid:"#295d8d",cutting:"#111827",laser:"#FF0000",processed:"#9ca3af",boundingBox:"#5191cc",grid:{major:"#295d8d",minor:"#5191cc"},axes:{x:"#df3b3b",y:"#06b881",z:"#295d8d"}}},"flexoki-dark":{background:"#100f0f",opacity:.9,rapidOpacity:.3,colors:{rapid:"#DA702C",cutting:"#3AA99F",laser:"#8B7EC8",processed:"#6f6e69",boundingBox:"#da702c",grid:{major:"#a89984",minor:"#6f6e69"},axes:{x:"#d14d41",y:"#879a39",z:"#4385be"}}},"tokyo-night":{background:"#1a1b26",opacity:.9,rapidOpacity:.3,colors:{rapid:"#ff9e64",cutting:"#7dcfff",laser:"#bb9af7",processed:"#565f89",boundingBox:"#73daca",grid:{major:"#7aa2f7",minor:"#414868"},axes:{x:"#f7768e",y:"#9ece6a",z:"#7aa2f7"}}},"gruvbox-light":{background:"#fbf1c7",opacity:.9,rapidOpacity:.3,colors:{rapid:"#d65d0e",cutting:"#3c3836",laser:"#b16286",processed:"#928374",boundingBox:"#076678",grid:{major:"#7c6f64",minor:"#a89984"},axes:{x:"#cc241d",y:"#98971a",z:"#458588"}}},"ayu-dark":{background:"#0b0e14",opacity:.9,rapidOpacity:.3,colors:{rapid:"#FFA659",cutting:"#73D0FF",laser:"#DFBFFF",processed:"#6E7C8F",boundingBox:"#95E6CB",grid:{major:"#77a9d7",minor:"#3e6590"},axes:{x:"#F28779",y:"#D5FF80",z:"#5CCFE6"}}},"ayu-light":{background:"#fafafa",opacity:.9,rapidOpacity:.3,colors:{rapid:"#FA8D3E",cutting:"#22A4E6",laser:"#A37ACC",processed:"#ADAEB1",boundingBox:"#5C6773",grid:{major:"#5c6773",minor:"#9aacba"},axes:{x:"#F07171",y:"#86B300",z:"#55B4D4"}}}};exports.GCodeSVGRenderer=e.GCodeSVGRenderer;exports.GCodeViewer=e.GCodeViewer;exports.ViewCube=e.ViewCube;exports.defaultGCodeViewerOptions=e.defaultGCodeViewerOptions;exports.defaultGCodeViewerTheme=e.defaultGCodeViewerTheme;exports.gCodeViewerThemePresets=a;
|
package/dist/viewer.js
CHANGED