@chestnutlabs/gcode-preview-element 0.2.0 → 0.3.0
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.
|
@@ -58,11 +58,17 @@ export declare class GcodePreviewElement extends HTMLElement {
|
|
|
58
58
|
/** Default true; only `show-travel="false"` hides travel. */
|
|
59
59
|
get showTravel(): boolean;
|
|
60
60
|
set showTravel(v: boolean);
|
|
61
|
+
/** DD-016 (#182): default true; only `show-wipe="false"` hides slicer wipe moves. */
|
|
62
|
+
get showWipe(): boolean;
|
|
63
|
+
set showWipe(v: boolean);
|
|
61
64
|
/** Default false; only `show-retractions="true"` shows markers. */
|
|
62
65
|
get showRetractions(): boolean;
|
|
63
66
|
set showRetractions(v: boolean);
|
|
64
67
|
get scrub(): number | null;
|
|
65
68
|
set scrub(v: number | null);
|
|
69
|
+
/** Time-based scrub cut in ms of print time (#181). */
|
|
70
|
+
get scrubTime(): number | null;
|
|
71
|
+
set scrubTime(v: number | null);
|
|
66
72
|
get layerRange(): [number, number] | null;
|
|
67
73
|
set layerRange(v: [number, number] | null);
|
|
68
74
|
get state(): GcodePreviewState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcode-preview-element.d.ts","sourceRoot":"","sources":["../src/gcode-preview-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"gcode-preview-element.d.ts","sourceRoot":"","sources":["../src/gcode-preview-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,uBAAuB,EACvB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAElB,MAAM,kCAAkC,CA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,IAAI,GAAG,IAAI;IAqCvF,kGAAkG;IAClG,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,iBAAiB;IAOzB,kEAAkE;IAClE,OAAO,CAAC,MAAM;CAyCf;AASD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAoB,GAAG,IAAI,CAGlE"}
|
|
@@ -12,7 +12,16 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { createPreviewController } from '@chestnutlabs/gcode-preview-core';
|
|
14
14
|
/** Observed scalar/boolean/number attributes; rich options are property-only. */
|
|
15
|
-
const OBSERVED = [
|
|
15
|
+
const OBSERVED = [
|
|
16
|
+
'quality',
|
|
17
|
+
'camera-mode',
|
|
18
|
+
'show-travel',
|
|
19
|
+
'show-wipe',
|
|
20
|
+
'show-retractions',
|
|
21
|
+
'scrub',
|
|
22
|
+
'scrub-time',
|
|
23
|
+
'layer-range'
|
|
24
|
+
];
|
|
16
25
|
/** The default tag name (DD-009 §4.5). */
|
|
17
26
|
export const DEFAULT_TAG = 'gcode-preview';
|
|
18
27
|
export class GcodePreviewElement extends HTMLElement {
|
|
@@ -115,6 +124,13 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
115
124
|
set showTravel(v) {
|
|
116
125
|
this.setAttribute('show-travel', v ? 'true' : 'false');
|
|
117
126
|
}
|
|
127
|
+
/** DD-016 (#182): default true; only `show-wipe="false"` hides slicer wipe moves. */
|
|
128
|
+
get showWipe() {
|
|
129
|
+
return this.getAttribute('show-wipe') !== 'false';
|
|
130
|
+
}
|
|
131
|
+
set showWipe(v) {
|
|
132
|
+
this.setAttribute('show-wipe', v ? 'true' : 'false');
|
|
133
|
+
}
|
|
118
134
|
/** Default false; only `show-retractions="true"` shows markers. */
|
|
119
135
|
get showRetractions() {
|
|
120
136
|
return this.getAttribute('show-retractions') === 'true';
|
|
@@ -129,6 +145,14 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
129
145
|
set scrub(v) {
|
|
130
146
|
this.reflect('scrub', v);
|
|
131
147
|
}
|
|
148
|
+
/** Time-based scrub cut in ms of print time (#181). */
|
|
149
|
+
get scrubTime() {
|
|
150
|
+
const a = this.getAttribute('scrub-time');
|
|
151
|
+
return a === null ? null : Number(a);
|
|
152
|
+
}
|
|
153
|
+
set scrubTime(v) {
|
|
154
|
+
this.reflect('scrub-time', v);
|
|
155
|
+
}
|
|
132
156
|
get layerRange() {
|
|
133
157
|
return parseLayerRange(this.getAttribute('layer-range'));
|
|
134
158
|
}
|
|
@@ -176,12 +200,15 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
176
200
|
this.controller = createPreviewController({
|
|
177
201
|
createWorker: this._createWorker,
|
|
178
202
|
renderer: {
|
|
203
|
+
// DD-014 D5: construction-time renderer selection (mode switching post-mount is out of scope).
|
|
204
|
+
mode: this.getAttribute('renderer') ?? undefined,
|
|
179
205
|
buildVolume: isMachine ? undefined : this._buildVolume,
|
|
180
206
|
quality: this.getAttribute('quality') ?? 'auto',
|
|
181
207
|
cameraMode: this.getAttribute('camera-mode') ?? undefined,
|
|
182
208
|
colorMode: this._colorMode,
|
|
183
209
|
tube: this._tube,
|
|
184
210
|
theme: this._theme,
|
|
211
|
+
adjacentLayers: this.hasAttribute('adjacent-layers') ? Number(this.getAttribute('adjacent-layers')) : undefined,
|
|
185
212
|
...this._rendererOptions
|
|
186
213
|
},
|
|
187
214
|
parseDefaults: this._parseOptions
|
|
@@ -215,12 +242,18 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
215
242
|
case 'show-travel':
|
|
216
243
|
c.setKindVisible('travel', value !== 'false');
|
|
217
244
|
break;
|
|
245
|
+
case 'show-wipe':
|
|
246
|
+
c.setKindVisible('wipe', value !== 'false');
|
|
247
|
+
break;
|
|
218
248
|
case 'show-retractions':
|
|
219
249
|
c.setShowRetractions(value === 'true');
|
|
220
250
|
break;
|
|
221
251
|
case 'scrub':
|
|
222
252
|
c.setScrubPosition(value === null ? null : Number(value));
|
|
223
253
|
break;
|
|
254
|
+
case 'scrub-time':
|
|
255
|
+
c.setScrubTime(value === null ? null : Number(value));
|
|
256
|
+
break;
|
|
224
257
|
case 'layer-range': {
|
|
225
258
|
const r = parseLayerRange(value);
|
|
226
259
|
if (r === null)
|
|
@@ -238,6 +271,7 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
238
271
|
applyRuntimeState() {
|
|
239
272
|
const c = this.requireController().controls;
|
|
240
273
|
c.setKindVisible('travel', this.showTravel);
|
|
274
|
+
c.setKindVisible('wipe', this.showWipe);
|
|
241
275
|
c.setShowRetractions(this.showRetractions);
|
|
242
276
|
const r = this.layerRange;
|
|
243
277
|
if (r === null)
|
|
@@ -245,6 +279,7 @@ export class GcodePreviewElement extends HTMLElement {
|
|
|
245
279
|
else
|
|
246
280
|
c.setLayerRange(r[0], r[1]);
|
|
247
281
|
c.setScrubPosition(this.scrub);
|
|
282
|
+
c.setScrubTime(this.scrubTime);
|
|
248
283
|
this.applyProgress();
|
|
249
284
|
}
|
|
250
285
|
applyProgress() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chestnutlabs/gcode-preview-element",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Framework-free <gcode-preview> Web Component for the Chestnut Labs G-code viewer (DD-007 D1 / DD-009 D5): a custom element bridging @chestnutlabs/gcode-preview-core, no framework peer dependency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gcode",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"test": "vitest run"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@chestnutlabs/gcode-parser": "0.
|
|
56
|
-
"@chestnutlabs/gcode-preview-core": "0.
|
|
57
|
-
"@chestnutlabs/gcode-renderer-three": "0.
|
|
58
|
-
"@chestnutlabs/toolpath-core": "0.
|
|
55
|
+
"@chestnutlabs/gcode-parser": "0.3.0",
|
|
56
|
+
"@chestnutlabs/gcode-preview-core": "0.3.0",
|
|
57
|
+
"@chestnutlabs/gcode-renderer-three": "0.3.0",
|
|
58
|
+
"@chestnutlabs/toolpath-core": "0.3.0"
|
|
59
59
|
}
|
|
60
60
|
}
|