@leafer-editor/worker 1.5.0 → 1.5.1

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/worker.js CHANGED
@@ -2032,13 +2032,11 @@ var LeaferUI = (function (exports) {
2032
2032
  this.worldTransform = {};
2033
2033
  if (!config)
2034
2034
  config = minSize;
2035
- if (!config.pixelRatio)
2036
- config.pixelRatio = Platform.devicePixelRatio;
2037
2035
  this.manager = manager;
2038
2036
  this.innerId = IncrementId.create(IncrementId.CNAVAS);
2039
2037
  const { width, height, pixelRatio } = config;
2040
2038
  this.autoLayout = !width || !height;
2041
- this.size.pixelRatio = pixelRatio;
2039
+ this.size.pixelRatio = pixelRatio | Platform.devicePixelRatio;
2042
2040
  this.config = config;
2043
2041
  this.init();
2044
2042
  }
@@ -2235,7 +2233,7 @@ var LeaferUI = (function (exports) {
2235
2233
  tempBounds$1.ceil();
2236
2234
  }
2237
2235
  isSameSize(size) {
2238
- return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
2236
+ return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
2239
2237
  }
2240
2238
  getSameCanvas(useSameWorldTransform, useSameSmooth) {
2241
2239
  const canvas = this.manager ? this.manager.get(this.size) : Creator.canvas(Object.assign({}, this.size));
@@ -4076,9 +4074,7 @@ var LeaferUI = (function (exports) {
4076
4074
  else if (typeof defaultValue === 'function') {
4077
4075
  property.get = function () {
4078
4076
  let v = this[computedKey];
4079
- if (v === undefined)
4080
- this[computedKey] = v = defaultValue(this.__leaf);
4081
- return v;
4077
+ return v === undefined ? defaultValue(this.__leaf) : v;
4082
4078
  };
4083
4079
  }
4084
4080
  if (key === 'width') {
@@ -6054,7 +6050,7 @@ var LeaferUI = (function (exports) {
6054
6050
  }
6055
6051
  }
6056
6052
 
6057
- const version = "1.5.0";
6053
+ const version = "1.5.1";
6058
6054
 
6059
6055
  class LeaferCanvas extends LeaferCanvasBase {
6060
6056
  get allowBackgroundColor() { return true; }
@@ -11613,7 +11609,9 @@ var LeaferUI = (function (exports) {
11613
11609
  Object.assign(this, data);
11614
11610
  }
11615
11611
  }
11612
+ EditorEvent.BEFORE_SELECT = 'editor.before_select';
11616
11613
  EditorEvent.SELECT = 'editor.select';
11614
+ EditorEvent.BEFORE_HOVER = 'editor.before_hover';
11617
11615
  EditorEvent.HOVER = 'editor.hover';
11618
11616
 
11619
11617
  class EditorMoveEvent extends EditorEvent {
@@ -11655,8 +11653,12 @@ var LeaferUI = (function (exports) {
11655
11653
  get() { return this[privateKey]; },
11656
11654
  set(value) {
11657
11655
  const old = this[privateKey];
11658
- if (old !== value)
11656
+ if (old !== value) {
11657
+ const type = key === 'target' ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
11658
+ if (this.hasEvent(type))
11659
+ this.emitEvent(new EditorEvent(type, { editor: this, value: value, oldValue: old }));
11659
11660
  this[privateKey] = value, fn(this, old);
11661
+ }
11660
11662
  }
11661
11663
  });
11662
11664
  };