leafer-ui 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/web.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
  const debug$5 = Debug.get('LeaferCanvas');
6060
6056
  class LeaferCanvas extends LeaferCanvasBase {
@@ -6176,7 +6172,7 @@ var LeaferUI = (function (exports) {
6176
6172
  else {
6177
6173
  window.addEventListener('resize', this.windowListener = () => {
6178
6174
  const pixelRatio = Platform.devicePixelRatio;
6179
- if (this.pixelRatio !== pixelRatio) {
6175
+ if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
6180
6176
  const { width, height } = this;
6181
6177
  this.emitResize({ width, height, pixelRatio });
6182
6178
  }
@@ -6193,7 +6189,7 @@ var LeaferUI = (function (exports) {
6193
6189
  checkAutoBounds(parentSize) {
6194
6190
  const view = this.view;
6195
6191
  const { x, y, width, height } = this.autoBounds.getBoundsFrom(parentSize);
6196
- const size = { width, height, pixelRatio: Platform.devicePixelRatio };
6192
+ const size = { width, height, pixelRatio: this.config.pixelRatio ? this.pixelRatio : Platform.devicePixelRatio };
6197
6193
  if (!this.isSameSize(size)) {
6198
6194
  const { style } = view;
6199
6195
  style.marginLeft = x + 'px';