@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 +11 -9
- package/dist/worker.js.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +11 -9
- package/dist/worker.module.js.map +1 -1
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +15 -15
package/dist/worker.module.js
CHANGED
|
@@ -2029,13 +2029,11 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2029
2029
|
this.worldTransform = {};
|
|
2030
2030
|
if (!config)
|
|
2031
2031
|
config = minSize;
|
|
2032
|
-
if (!config.pixelRatio)
|
|
2033
|
-
config.pixelRatio = Platform.devicePixelRatio;
|
|
2034
2032
|
this.manager = manager;
|
|
2035
2033
|
this.innerId = IncrementId.create(IncrementId.CNAVAS);
|
|
2036
2034
|
const { width, height, pixelRatio } = config;
|
|
2037
2035
|
this.autoLayout = !width || !height;
|
|
2038
|
-
this.size.pixelRatio = pixelRatio;
|
|
2036
|
+
this.size.pixelRatio = pixelRatio | Platform.devicePixelRatio;
|
|
2039
2037
|
this.config = config;
|
|
2040
2038
|
this.init();
|
|
2041
2039
|
}
|
|
@@ -2232,7 +2230,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2232
2230
|
tempBounds$1.ceil();
|
|
2233
2231
|
}
|
|
2234
2232
|
isSameSize(size) {
|
|
2235
|
-
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
2233
|
+
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
2236
2234
|
}
|
|
2237
2235
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2238
2236
|
const canvas = this.manager ? this.manager.get(this.size) : Creator.canvas(Object.assign({}, this.size));
|
|
@@ -4073,9 +4071,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4073
4071
|
else if (typeof defaultValue === 'function') {
|
|
4074
4072
|
property.get = function () {
|
|
4075
4073
|
let v = this[computedKey];
|
|
4076
|
-
|
|
4077
|
-
this[computedKey] = v = defaultValue(this.__leaf);
|
|
4078
|
-
return v;
|
|
4074
|
+
return v === undefined ? defaultValue(this.__leaf) : v;
|
|
4079
4075
|
};
|
|
4080
4076
|
}
|
|
4081
4077
|
if (key === 'width') {
|
|
@@ -6051,7 +6047,7 @@ class LeafLevelList {
|
|
|
6051
6047
|
}
|
|
6052
6048
|
}
|
|
6053
6049
|
|
|
6054
|
-
const version = "1.5.
|
|
6050
|
+
const version = "1.5.1";
|
|
6055
6051
|
|
|
6056
6052
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6057
6053
|
get allowBackgroundColor() { return true; }
|
|
@@ -11610,7 +11606,9 @@ class EditorEvent extends Event {
|
|
|
11610
11606
|
Object.assign(this, data);
|
|
11611
11607
|
}
|
|
11612
11608
|
}
|
|
11609
|
+
EditorEvent.BEFORE_SELECT = 'editor.before_select';
|
|
11613
11610
|
EditorEvent.SELECT = 'editor.select';
|
|
11611
|
+
EditorEvent.BEFORE_HOVER = 'editor.before_hover';
|
|
11614
11612
|
EditorEvent.HOVER = 'editor.hover';
|
|
11615
11613
|
|
|
11616
11614
|
class EditorMoveEvent extends EditorEvent {
|
|
@@ -11652,8 +11650,12 @@ function targetAttr(fn) {
|
|
|
11652
11650
|
get() { return this[privateKey]; },
|
|
11653
11651
|
set(value) {
|
|
11654
11652
|
const old = this[privateKey];
|
|
11655
|
-
if (old !== value)
|
|
11653
|
+
if (old !== value) {
|
|
11654
|
+
const type = key === 'target' ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
11655
|
+
if (this.hasEvent(type))
|
|
11656
|
+
this.emitEvent(new EditorEvent(type, { editor: this, value: value, oldValue: old }));
|
|
11656
11657
|
this[privateKey] = value, fn(this, old);
|
|
11658
|
+
}
|
|
11657
11659
|
}
|
|
11658
11660
|
});
|
|
11659
11661
|
};
|