Skip to content

Commit 731849f

Browse files
committed
Fix startLayer
1 parent 1a74434 commit 731849f

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

src/webgl-preview.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,10 @@ export class WebGLPreview {
271271
return this._startLayer;
272272
}
273273
set startLayer(value: number) {
274-
this._startLayer = value;
275-
if (this.countLayers > 1) {
276-
if (value <= this.countLayers && value > 0) {
274+
if (this.countLayers > 1 && value > 0) {
275+
this._startLayer = value;
276+
if (value <= this.countLayers) {
277+
console.log(value);
277278
const layer = this.job.layers[value - 1];
278279
this.minPlane.constant = -this.minPlane.normal.y * layer.z;
279280
this.clippingPlanes = [this.minPlane, this.maxPlane];
@@ -288,12 +289,12 @@ export class WebGLPreview {
288289
return this._endLayer;
289290
}
290291
set endLayer(value: number) {
291-
this._endLayer = value;
292-
if (this._singleLayerMode) {
293-
this.startLayer = this._endLayer;
294-
}
295-
if (this.countLayers > 1) {
296-
if (value <= this.countLayers && value > 0) {
292+
if (this.countLayers > 1 && value > 0) {
293+
this._endLayer = value;
294+
if (this._singleLayerMode === true) {
295+
this.startLayer = this._endLayer;
296+
}
297+
if (value <= this.countLayers) {
297298
const layer = this.job.layers[value - 1];
298299
this.maxPlane.constant = -this.maxPlane.normal.y * layer.z;
299300
this.clippingPlanes = [this.minPlane, this.maxPlane];
@@ -308,8 +309,6 @@ export class WebGLPreview {
308309
this._singleLayerMode = value;
309310
if (value) {
310311
this.startLayer = this.endLayer - 1;
311-
} else {
312-
this.startLayer = 1;
313312
}
314313
}
315314

0 commit comments

Comments
 (0)