@leafer/core 1.9.6 → 1.9.8

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/lib/core.cjs CHANGED
@@ -249,18 +249,34 @@ class LeafData {
249
249
  }
250
250
  }
251
251
 
252
- const {round: round$3, pow: pow$1, PI: PI$1} = Math;
253
-
254
- const MathHelper = {
255
- within(value, min, max) {
256
- if (isObject(min)) max = min.max, min = min.min;
257
- if (!isUndefined(min) && value < min) value = min;
258
- if (!isUndefined(max) && value > max) value = max;
259
- return value;
252
+ let tempA, tempB, tempTo;
253
+
254
+ const {max: max$1} = Math, tempFour = [ 0, 0, 0, 0 ];
255
+
256
+ const FourNumberHelper = {
257
+ zero: [ ...tempFour ],
258
+ tempFour: tempFour,
259
+ set(to, top, right, bottom, left) {
260
+ if (right === undefined) right = bottom = left = top;
261
+ to[0] = top;
262
+ to[1] = right;
263
+ to[2] = bottom;
264
+ to[3] = left;
265
+ return to;
260
266
  },
261
- fourNumber(num, maxValue) {
267
+ setTemp(top, right, bottom, left) {
268
+ return set$1(tempFour, top, right, bottom, left);
269
+ },
270
+ toTempAB(a, b, change) {
271
+ tempTo = change ? isNumber(a) ? b : a : [];
272
+ if (isNumber(a)) tempA = setTemp(a), tempB = b; else if (isNumber(b)) tempA = a,
273
+ tempB = setTemp(b); else tempA = a, tempB = b;
274
+ if (tempA.length !== 4) tempA = get$1(tempA);
275
+ if (tempB.length !== 4) tempB = get$1(tempB);
276
+ },
277
+ get(num, maxValue) {
262
278
  let data;
263
- if (isArray(num)) {
279
+ if (!isNumber(num)) {
264
280
  switch (num.length) {
265
281
  case 4:
266
282
  data = isUndefined(maxValue) ? num : [ ...num ];
@@ -283,9 +299,39 @@ const MathHelper = {
283
299
  }
284
300
  }
285
301
  if (!data) data = [ num, num, num, num ];
286
- if (maxValue) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
302
+ if (!isUndefined(maxValue)) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
287
303
  return data;
288
304
  },
305
+ max(t, other, change) {
306
+ if (isNumber(t) && isNumber(other)) return max$1(t, other);
307
+ toTempAB(t, other, change);
308
+ return set$1(tempTo, max$1(tempA[0], tempB[0]), max$1(tempA[1], tempB[1]), max$1(tempA[2], tempB[2]), max$1(tempA[3], tempB[3]));
309
+ },
310
+ add(t, other, change) {
311
+ if (isNumber(t) && isNumber(other)) return t + other;
312
+ toTempAB(t, other, change);
313
+ return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
314
+ },
315
+ swapAndScale(t, scaleX, scaleY, change) {
316
+ if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
317
+ const to = change ? t : [];
318
+ const [top, right, bottom, left] = t.length === 4 ? t : get$1(t);
319
+ return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
320
+ }
321
+ };
322
+
323
+ const {set: set$1, get: get$1, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
324
+
325
+ const {round: round$3, pow: pow$1, PI: PI$1} = Math;
326
+
327
+ const MathHelper = {
328
+ within(value, min, max) {
329
+ if (isObject(min)) max = min.max, min = min.min;
330
+ if (!isUndefined(min) && value < min) value = min;
331
+ if (!isUndefined(max) && value > max) value = max;
332
+ return value;
333
+ },
334
+ fourNumber: FourNumberHelper.get,
289
335
  formatRotation(rotation, unsign) {
290
336
  rotation %= 360;
291
337
  if (unsign) {
@@ -425,6 +471,15 @@ const MatrixHelper = {
425
471
  t.c *= scaleY;
426
472
  t.d *= scaleY;
427
473
  },
474
+ pixelScale(t, pixelRatio, to) {
475
+ to || (to = t);
476
+ to.a = t.a * pixelRatio;
477
+ to.b = t.b * pixelRatio;
478
+ to.c = t.c * pixelRatio;
479
+ to.d = t.d * pixelRatio;
480
+ to.e = t.e * pixelRatio;
481
+ to.f = t.f * pixelRatio;
482
+ },
428
483
  scaleOfOuter(t, origin, scaleX, scaleY) {
429
484
  M$6.toInnerPoint(t, origin, tempPoint$3);
430
485
  M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
@@ -924,6 +979,10 @@ class Matrix {
924
979
  this.scaleY *= y || x;
925
980
  return this;
926
981
  }
982
+ pixelScale(pixelRatio) {
983
+ MatrixHelper.pixelScale(this, pixelRatio);
984
+ return this;
985
+ }
927
986
  scaleOfOuter(origin, x, y) {
928
987
  MatrixHelper.scaleOfOuter(this, origin, x, y);
929
988
  return this;
@@ -1207,19 +1266,11 @@ const BoundsHelper = {
1207
1266
  B.move(t, x, y);
1208
1267
  return t;
1209
1268
  },
1210
- toOffsetOutBounds(t, to, parent) {
1211
- if (!to) {
1212
- to = t;
1213
- } else {
1214
- copy$6(to, t);
1215
- }
1216
- if (parent) {
1217
- to.offsetX = -(B.maxX(parent) - t.x);
1218
- to.offsetY = -(B.maxY(parent) - t.y);
1219
- } else {
1220
- to.offsetX = t.x + t.width;
1221
- to.offsetY = t.y + t.height;
1222
- }
1269
+ toOffsetOutBounds(t, to, offsetBounds) {
1270
+ if (!to) to = t; else copy$6(to, t);
1271
+ if (!offsetBounds) offsetBounds = t;
1272
+ to.offsetX = B.maxX(offsetBounds);
1273
+ to.offsetY = B.maxY(offsetBounds);
1223
1274
  B.move(to, -to.offsetX, -to.offsetY);
1224
1275
  },
1225
1276
  scale(t, scaleX, scaleY = scaleX, onlySize) {
@@ -2148,7 +2199,7 @@ __decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
2148
2199
 
2149
2200
  __decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
2150
2201
 
2151
- const {copy: copy$5, multiplyParent: multiplyParent$3} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2202
+ const {copy: copy$5, multiplyParent: multiplyParent$3, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2152
2203
 
2153
2204
  const minSize = {
2154
2205
  width: 1,
@@ -2249,13 +2300,8 @@ class LeaferCanvasBase extends Canvas {
2249
2300
  setWorld(matrix, parentMatrix) {
2250
2301
  const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
2251
2302
  if (parentMatrix) multiplyParent$3(matrix, parentMatrix, w);
2252
- w.a = matrix.a * pixelRatio;
2253
- w.b = matrix.b * pixelRatio;
2254
- w.c = matrix.c * pixelRatio;
2255
- w.d = matrix.d * pixelRatio;
2256
- w.e = matrix.e * pixelRatio;
2257
- w.f = matrix.f * pixelRatio;
2258
- if (pixelSnap) {
2303
+ pixelScale(matrix, pixelRatio, w);
2304
+ if (pixelSnap && !matrix.ignorePixelSnap) {
2259
2305
  if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
2260
2306
  w.f = round$1(w.f);
2261
2307
  }
@@ -4267,6 +4313,18 @@ function surfaceType(defaultValue) {
4267
4313
  }));
4268
4314
  }
4269
4315
 
4316
+ function dimType(defaultValue) {
4317
+ return decorateLeafAttr(defaultValue, key => attr({
4318
+ set(value) {
4319
+ if (this.__setAttr(key, value)) {
4320
+ const data = this.__;
4321
+ DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4322
+ this.__layout.surfaceChange();
4323
+ }
4324
+ }
4325
+ }));
4326
+ }
4327
+
4270
4328
  function opacityType(defaultValue) {
4271
4329
  return decorateLeafAttr(defaultValue, key => attr({
4272
4330
  set(value) {
@@ -4311,7 +4369,7 @@ function sortType(defaultValue) {
4311
4369
  return decorateLeafAttr(defaultValue, key => attr({
4312
4370
  set(value) {
4313
4371
  if (this.__setAttr(key, value)) {
4314
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
4372
+ this.__layout.surfaceChange();
4315
4373
  this.waitParent(() => {
4316
4374
  this.parent.__layout.childrenSortChange();
4317
4375
  });
@@ -4348,7 +4406,7 @@ function hitType(defaultValue) {
4348
4406
  set(value) {
4349
4407
  if (this.__setAttr(key, value)) {
4350
4408
  this.__layout.hitCanvasChanged = true;
4351
- if (Debug.showBounds === "hit") this.__layout.surfaceChanged || this.__layout.surfaceChange();
4409
+ if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4352
4410
  if (this.leafer) this.leafer.updateCursor();
4353
4411
  }
4354
4412
  }
@@ -5853,8 +5911,8 @@ const LeafBounds = {
5853
5911
  copyAndSpread(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5854
5912
  },
5855
5913
  __updateRenderBounds(_bounds) {
5856
- const layout = this.__layout;
5857
- layout.renderSpread > 0 ? copyAndSpread(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$1(layout.renderBounds, layout.strokeBounds);
5914
+ const layout = this.__layout, {renderSpread: renderSpread} = layout;
5915
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$1(layout.renderBounds, layout.strokeBounds) : copyAndSpread(layout.renderBounds, layout.boxBounds, renderSpread);
5858
5916
  }
5859
5917
  };
5860
5918
 
@@ -5863,6 +5921,7 @@ const LeafRender = {
5863
5921
  if (options.shape) return this.__renderShape(canvas, options);
5864
5922
  if (this.__worldOpacity) {
5865
5923
  const data = this.__;
5924
+ if (data.bright && !options.topRendering) return options.topList.add(this);
5866
5925
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5867
5926
  canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5868
5927
  if (this.__.__single) {
@@ -5911,7 +5970,9 @@ const BranchRender = {
5911
5970
  this.__nowWorld = this.__getNowWorld(options);
5912
5971
  if (this.__worldOpacity) {
5913
5972
  const data = this.__;
5914
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5973
+ if (data.__useDim) {
5974
+ if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5975
+ }
5915
5976
  if (data.__single && !this.isBranchLeaf) {
5916
5977
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5917
5978
  const tempCanvas = canvas.getSameCanvas(false, true);
@@ -5949,6 +6010,8 @@ const tempScaleData = {};
5949
6010
 
5950
6011
  const {LEAF: LEAF, create: create} = IncrementId;
5951
6012
 
6013
+ const {stintSet: stintSet} = DataHelper;
6014
+
5952
6015
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent} = MatrixHelper;
5953
6016
 
5954
6017
  const {toOuterOf: toOuterOf} = BoundsHelper;
@@ -6230,7 +6293,8 @@ exports.Leaf = class Leaf {
6230
6293
  const cameraWorld = this.__cameraWorld, world = this.__world;
6231
6294
  multiplyParent(world, options.matrix, cameraWorld, undefined, world);
6232
6295
  toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
6233
- cameraWorld.half !== world.half && (cameraWorld.half = world.half);
6296
+ stintSet(cameraWorld, "half", world.half);
6297
+ stintSet(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6234
6298
  return cameraWorld;
6235
6299
  } else {
6236
6300
  return this.__world;
@@ -6753,7 +6817,7 @@ class LeafLevelList {
6753
6817
  }
6754
6818
  }
6755
6819
 
6756
- const version = "1.9.6";
6820
+ const version = "1.9.8";
6757
6821
 
6758
6822
  exports.AlignHelper = AlignHelper;
6759
6823
 
@@ -6793,6 +6857,8 @@ exports.Eventer = Eventer;
6793
6857
 
6794
6858
  exports.FileHelper = FileHelper;
6795
6859
 
6860
+ exports.FourNumberHelper = FourNumberHelper;
6861
+
6796
6862
  exports.ImageEvent = ImageEvent;
6797
6863
 
6798
6864
  exports.ImageManager = ImageManager;
@@ -6927,6 +6993,8 @@ exports.defineKey = defineKey;
6927
6993
 
6928
6994
  exports.defineLeafAttr = defineLeafAttr;
6929
6995
 
6996
+ exports.dimType = dimType;
6997
+
6930
6998
  exports.doBoundsType = doBoundsType;
6931
6999
 
6932
7000
  exports.doStrokeType = doStrokeType;
package/lib/core.esm.js CHANGED
@@ -247,18 +247,34 @@ class LeafData {
247
247
  }
248
248
  }
249
249
 
250
- const {round: round$3, pow: pow$1, PI: PI$1} = Math;
251
-
252
- const MathHelper = {
253
- within(value, min, max) {
254
- if (isObject(min)) max = min.max, min = min.min;
255
- if (!isUndefined(min) && value < min) value = min;
256
- if (!isUndefined(max) && value > max) value = max;
257
- return value;
250
+ let tempA, tempB, tempTo;
251
+
252
+ const {max: max$1} = Math, tempFour = [ 0, 0, 0, 0 ];
253
+
254
+ const FourNumberHelper = {
255
+ zero: [ ...tempFour ],
256
+ tempFour: tempFour,
257
+ set(to, top, right, bottom, left) {
258
+ if (right === undefined) right = bottom = left = top;
259
+ to[0] = top;
260
+ to[1] = right;
261
+ to[2] = bottom;
262
+ to[3] = left;
263
+ return to;
258
264
  },
259
- fourNumber(num, maxValue) {
265
+ setTemp(top, right, bottom, left) {
266
+ return set$1(tempFour, top, right, bottom, left);
267
+ },
268
+ toTempAB(a, b, change) {
269
+ tempTo = change ? isNumber(a) ? b : a : [];
270
+ if (isNumber(a)) tempA = setTemp(a), tempB = b; else if (isNumber(b)) tempA = a,
271
+ tempB = setTemp(b); else tempA = a, tempB = b;
272
+ if (tempA.length !== 4) tempA = get$1(tempA);
273
+ if (tempB.length !== 4) tempB = get$1(tempB);
274
+ },
275
+ get(num, maxValue) {
260
276
  let data;
261
- if (isArray(num)) {
277
+ if (!isNumber(num)) {
262
278
  switch (num.length) {
263
279
  case 4:
264
280
  data = isUndefined(maxValue) ? num : [ ...num ];
@@ -281,9 +297,39 @@ const MathHelper = {
281
297
  }
282
298
  }
283
299
  if (!data) data = [ num, num, num, num ];
284
- if (maxValue) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
300
+ if (!isUndefined(maxValue)) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
285
301
  return data;
286
302
  },
303
+ max(t, other, change) {
304
+ if (isNumber(t) && isNumber(other)) return max$1(t, other);
305
+ toTempAB(t, other, change);
306
+ return set$1(tempTo, max$1(tempA[0], tempB[0]), max$1(tempA[1], tempB[1]), max$1(tempA[2], tempB[2]), max$1(tempA[3], tempB[3]));
307
+ },
308
+ add(t, other, change) {
309
+ if (isNumber(t) && isNumber(other)) return t + other;
310
+ toTempAB(t, other, change);
311
+ return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
312
+ },
313
+ swapAndScale(t, scaleX, scaleY, change) {
314
+ if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
315
+ const to = change ? t : [];
316
+ const [top, right, bottom, left] = t.length === 4 ? t : get$1(t);
317
+ return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
318
+ }
319
+ };
320
+
321
+ const {set: set$1, get: get$1, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
322
+
323
+ const {round: round$3, pow: pow$1, PI: PI$1} = Math;
324
+
325
+ const MathHelper = {
326
+ within(value, min, max) {
327
+ if (isObject(min)) max = min.max, min = min.min;
328
+ if (!isUndefined(min) && value < min) value = min;
329
+ if (!isUndefined(max) && value > max) value = max;
330
+ return value;
331
+ },
332
+ fourNumber: FourNumberHelper.get,
287
333
  formatRotation(rotation, unsign) {
288
334
  rotation %= 360;
289
335
  if (unsign) {
@@ -423,6 +469,15 @@ const MatrixHelper = {
423
469
  t.c *= scaleY;
424
470
  t.d *= scaleY;
425
471
  },
472
+ pixelScale(t, pixelRatio, to) {
473
+ to || (to = t);
474
+ to.a = t.a * pixelRatio;
475
+ to.b = t.b * pixelRatio;
476
+ to.c = t.c * pixelRatio;
477
+ to.d = t.d * pixelRatio;
478
+ to.e = t.e * pixelRatio;
479
+ to.f = t.f * pixelRatio;
480
+ },
426
481
  scaleOfOuter(t, origin, scaleX, scaleY) {
427
482
  M$6.toInnerPoint(t, origin, tempPoint$3);
428
483
  M$6.scaleOfInner(t, tempPoint$3, scaleX, scaleY);
@@ -922,6 +977,10 @@ class Matrix {
922
977
  this.scaleY *= y || x;
923
978
  return this;
924
979
  }
980
+ pixelScale(pixelRatio) {
981
+ MatrixHelper.pixelScale(this, pixelRatio);
982
+ return this;
983
+ }
925
984
  scaleOfOuter(origin, x, y) {
926
985
  MatrixHelper.scaleOfOuter(this, origin, x, y);
927
986
  return this;
@@ -1205,19 +1264,11 @@ const BoundsHelper = {
1205
1264
  B.move(t, x, y);
1206
1265
  return t;
1207
1266
  },
1208
- toOffsetOutBounds(t, to, parent) {
1209
- if (!to) {
1210
- to = t;
1211
- } else {
1212
- copy$6(to, t);
1213
- }
1214
- if (parent) {
1215
- to.offsetX = -(B.maxX(parent) - t.x);
1216
- to.offsetY = -(B.maxY(parent) - t.y);
1217
- } else {
1218
- to.offsetX = t.x + t.width;
1219
- to.offsetY = t.y + t.height;
1220
- }
1267
+ toOffsetOutBounds(t, to, offsetBounds) {
1268
+ if (!to) to = t; else copy$6(to, t);
1269
+ if (!offsetBounds) offsetBounds = t;
1270
+ to.offsetX = B.maxX(offsetBounds);
1271
+ to.offsetY = B.maxY(offsetBounds);
1221
1272
  B.move(to, -to.offsetX, -to.offsetY);
1222
1273
  },
1223
1274
  scale(t, scaleX, scaleY = scaleX, onlySize) {
@@ -2146,7 +2197,7 @@ __decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
2146
2197
 
2147
2198
  __decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
2148
2199
 
2149
- const {copy: copy$5, multiplyParent: multiplyParent$3} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2200
+ const {copy: copy$5, multiplyParent: multiplyParent$3, pixelScale: pixelScale} = MatrixHelper, {round: round$1} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
2150
2201
 
2151
2202
  const minSize = {
2152
2203
  width: 1,
@@ -2247,13 +2298,8 @@ class LeaferCanvasBase extends Canvas {
2247
2298
  setWorld(matrix, parentMatrix) {
2248
2299
  const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
2249
2300
  if (parentMatrix) multiplyParent$3(matrix, parentMatrix, w);
2250
- w.a = matrix.a * pixelRatio;
2251
- w.b = matrix.b * pixelRatio;
2252
- w.c = matrix.c * pixelRatio;
2253
- w.d = matrix.d * pixelRatio;
2254
- w.e = matrix.e * pixelRatio;
2255
- w.f = matrix.f * pixelRatio;
2256
- if (pixelSnap) {
2301
+ pixelScale(matrix, pixelRatio, w);
2302
+ if (pixelSnap && !matrix.ignorePixelSnap) {
2257
2303
  if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$1(w.e - .5) + .5, w.f = round$1(w.f - .5) + .5; else w.e = round$1(w.e),
2258
2304
  w.f = round$1(w.f);
2259
2305
  }
@@ -4265,6 +4311,18 @@ function surfaceType(defaultValue) {
4265
4311
  }));
4266
4312
  }
4267
4313
 
4314
+ function dimType(defaultValue) {
4315
+ return decorateLeafAttr(defaultValue, key => attr({
4316
+ set(value) {
4317
+ if (this.__setAttr(key, value)) {
4318
+ const data = this.__;
4319
+ DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
4320
+ this.__layout.surfaceChange();
4321
+ }
4322
+ }
4323
+ }));
4324
+ }
4325
+
4268
4326
  function opacityType(defaultValue) {
4269
4327
  return decorateLeafAttr(defaultValue, key => attr({
4270
4328
  set(value) {
@@ -4309,7 +4367,7 @@ function sortType(defaultValue) {
4309
4367
  return decorateLeafAttr(defaultValue, key => attr({
4310
4368
  set(value) {
4311
4369
  if (this.__setAttr(key, value)) {
4312
- this.__layout.surfaceChanged || this.__layout.surfaceChange();
4370
+ this.__layout.surfaceChange();
4313
4371
  this.waitParent(() => {
4314
4372
  this.parent.__layout.childrenSortChange();
4315
4373
  });
@@ -4346,7 +4404,7 @@ function hitType(defaultValue) {
4346
4404
  set(value) {
4347
4405
  if (this.__setAttr(key, value)) {
4348
4406
  this.__layout.hitCanvasChanged = true;
4349
- if (Debug.showBounds === "hit") this.__layout.surfaceChanged || this.__layout.surfaceChange();
4407
+ if (Debug.showBounds === "hit") this.__layout.surfaceChange();
4350
4408
  if (this.leafer) this.leafer.updateCursor();
4351
4409
  }
4352
4410
  }
@@ -5851,8 +5909,8 @@ const LeafBounds = {
5851
5909
  copyAndSpread(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
5852
5910
  },
5853
5911
  __updateRenderBounds(_bounds) {
5854
- const layout = this.__layout;
5855
- layout.renderSpread > 0 ? copyAndSpread(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$1(layout.renderBounds, layout.strokeBounds);
5912
+ const layout = this.__layout, {renderSpread: renderSpread} = layout;
5913
+ isNumber(renderSpread) && renderSpread <= 0 ? copy$1(layout.renderBounds, layout.strokeBounds) : copyAndSpread(layout.renderBounds, layout.boxBounds, renderSpread);
5856
5914
  }
5857
5915
  };
5858
5916
 
@@ -5861,6 +5919,7 @@ const LeafRender = {
5861
5919
  if (options.shape) return this.__renderShape(canvas, options);
5862
5920
  if (this.__worldOpacity) {
5863
5921
  const data = this.__;
5922
+ if (data.bright && !options.topRendering) return options.topList.add(this);
5864
5923
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5865
5924
  canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
5866
5925
  if (this.__.__single) {
@@ -5909,7 +5968,9 @@ const BranchRender = {
5909
5968
  this.__nowWorld = this.__getNowWorld(options);
5910
5969
  if (this.__worldOpacity) {
5911
5970
  const data = this.__;
5912
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5971
+ if (data.__useDim) {
5972
+ if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5973
+ }
5913
5974
  if (data.__single && !this.isBranchLeaf) {
5914
5975
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
5915
5976
  const tempCanvas = canvas.getSameCanvas(false, true);
@@ -5947,6 +6008,8 @@ const tempScaleData = {};
5947
6008
 
5948
6009
  const {LEAF: LEAF, create: create} = IncrementId;
5949
6010
 
6011
+ const {stintSet: stintSet} = DataHelper;
6012
+
5950
6013
  const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent} = MatrixHelper;
5951
6014
 
5952
6015
  const {toOuterOf: toOuterOf} = BoundsHelper;
@@ -6228,7 +6291,8 @@ let Leaf = class Leaf {
6228
6291
  const cameraWorld = this.__cameraWorld, world = this.__world;
6229
6292
  multiplyParent(world, options.matrix, cameraWorld, undefined, world);
6230
6293
  toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
6231
- cameraWorld.half !== world.half && (cameraWorld.half = world.half);
6294
+ stintSet(cameraWorld, "half", world.half);
6295
+ stintSet(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
6232
6296
  return cameraWorld;
6233
6297
  } else {
6234
6298
  return this.__world;
@@ -6751,6 +6815,6 @@ class LeafLevelList {
6751
6815
  }
6752
6816
  }
6753
6817
 
6754
- const version = "1.9.6";
6818
+ const version = "1.9.8";
6755
6819
 
6756
- export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useModule, version, visibleType };
6820
+ export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Branch, BranchHelper, BranchRender, CanvasManager, ChildEvent, Creator, DataHelper, Debug, Direction4, Direction9, EllipseHelper, Event, EventCreator, Eventer, FileHelper, FourNumberHelper, ImageEvent, ImageManager, IncrementId, LayoutEvent, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, LeaferCanvasBase, LeaferEvent, LeaferImage, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Platform, Plugin, Point, PointHelper, PropertyEvent, RectHelper, RenderEvent, ResizeEvent, Resource, Run, StringNumberMap, TaskItem, TaskProcessor, TwoPointBoundsHelper, UICreator, WaitHelper, WatchEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds, tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useModule, version, visibleType };