mol_plot_all 1.2.237 → 1.2.240

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/web.js CHANGED
@@ -1257,17 +1257,27 @@ var $;
1257
1257
  };
1258
1258
  }
1259
1259
  }
1260
- recall(...args) {
1261
- if (this.cursor > $mol_wire_cursor.fresh) {
1262
- try {
1263
- this.once();
1264
- }
1265
- catch (error) {
1266
- if (error instanceof Promise)
1267
- $mol_fail_hidden(error);
1268
- }
1260
+ resync(...args) {
1261
+ let res;
1262
+ try {
1263
+ res = this.recall(...args);
1264
+ }
1265
+ catch (error) {
1266
+ if (error instanceof Promise)
1267
+ $mol_fail_hidden(error);
1268
+ res = error;
1269
+ }
1270
+ try {
1271
+ this.once();
1272
+ }
1273
+ catch (error) {
1274
+ if (error instanceof Promise)
1275
+ $mol_fail_hidden(error);
1269
1276
  }
1270
- return this.put(this.task.call(this.host, ...args));
1277
+ return this.put(res);
1278
+ }
1279
+ recall(...args) {
1280
+ return this.task.call(this.host, ...args);
1271
1281
  }
1272
1282
  once() {
1273
1283
  return this.sync();
@@ -1313,6 +1323,9 @@ var $;
1313
1323
  return next;
1314
1324
  }
1315
1325
  }
1326
+ __decorate([
1327
+ $mol_wire_method
1328
+ ], $mol_wire_atom.prototype, "resync", null);
1316
1329
  __decorate([
1317
1330
  $mol_wire_method
1318
1331
  ], $mol_wire_atom.prototype, "recall", null);
@@ -1360,7 +1373,7 @@ var $;
1360
1373
  return atom.sync();
1361
1374
  }
1362
1375
  }
1363
- return atom.recall(...args);
1376
+ return atom.resync(...args);
1364
1377
  };
1365
1378
  Object.defineProperty(wrapper, 'name', { value: func.name + ' ' });
1366
1379
  Object.assign(wrapper, { orig: func });
@@ -2116,7 +2129,16 @@ var $;
2116
2129
  function $mol_view_watch() {
2117
2130
  new $mol_after_frame($mol_view_watch);
2118
2131
  for (const view of $mol_view.watchers) {
2119
- view.view_rect_cache(view.dom_node().getBoundingClientRect().toJSON());
2132
+ const prev = view.view_rect_cache();
2133
+ const next = view.dom_node().getBoundingClientRect();
2134
+ if (next.left === 0 && next.right === 0 && next.width === 0) {
2135
+ if (prev)
2136
+ view.view_rect_cache(null);
2137
+ continue;
2138
+ }
2139
+ if (!prev || prev.x !== next.x || prev.y !== next.y || prev.width !== next.width || prev.height !== next.height) {
2140
+ view.view_rect_cache(next);
2141
+ }
2120
2142
  }
2121
2143
  }
2122
2144
  $mol_view_watch();
@@ -2353,8 +2375,11 @@ var $;
2353
2375
  return this[0].map((_, i) => this.map(row => row[i]));
2354
2376
  }
2355
2377
  get x() { return this[0]; }
2378
+ set x(next) { this[0] = next; }
2356
2379
  get y() { return this[1]; }
2380
+ set y(next) { this[1] = next; }
2357
2381
  get z() { return this[2]; }
2382
+ set z(next) { this[2] = next; }
2358
2383
  }
2359
2384
  $.$mol_vector = $mol_vector;
2360
2385
  class $mol_vector_1d extends $mol_vector {
@@ -2367,10 +2392,17 @@ var $;
2367
2392
  }
2368
2393
  $.$mol_vector_3d = $mol_vector_3d;
2369
2394
  class $mol_vector_range extends $mol_vector {
2370
- get [0]() { return super[0]; }
2371
- get [1]() { return super[1]; }
2395
+ 0;
2396
+ 1;
2397
+ constructor(min, max) {
2398
+ super(min, max);
2399
+ this[0] = min;
2400
+ this[1] = max;
2401
+ }
2372
2402
  get min() { return this[0]; }
2403
+ set min(next) { this[0] = next; }
2373
2404
  get max() { return this[1]; }
2405
+ set max(next) { this[1] = next; }
2374
2406
  get inversed() {
2375
2407
  return new this.constructor(this.max, this.min);
2376
2408
  }
@@ -2676,7 +2708,14 @@ var $;
2676
2708
  const series_x = this.series_x();
2677
2709
  const series_y = this.series_y();
2678
2710
  for (let i = 0; i < series_x.length; i++) {
2679
- next = next.expanded1([this.repos_x(series_x[i]), this.repos_y(series_y[i])]);
2711
+ if (series_x[i] > next.x.max)
2712
+ next.x.max = series_x[i];
2713
+ if (series_x[i] < next.x.min)
2714
+ next.x.min = series_x[i];
2715
+ if (series_y[i] > next.y.max)
2716
+ next.y.max = series_y[i];
2717
+ if (series_y[i] < next.y.min)
2718
+ next.y.min = series_y[i];
2680
2719
  }
2681
2720
  return next;
2682
2721
  }
@@ -4030,16 +4069,17 @@ var $;
4030
4069
  "use strict";
4031
4070
  var $;
4032
4071
  (function ($) {
4033
- function $mol_coord_pack(a, b) {
4034
- return a << 16 | b & 0xFFFF;
4072
+ const mask = 0b11111_11111_11111;
4073
+ function $mol_coord_pack(high, low) {
4074
+ return (high << 17 >>> 2) | (low & mask);
4035
4075
  }
4036
4076
  $.$mol_coord_pack = $mol_coord_pack;
4037
- function $mol_coord_high(key) {
4038
- return key >> 16;
4077
+ function $mol_coord_high(pack) {
4078
+ return pack << 2 >> 17;
4039
4079
  }
4040
4080
  $.$mol_coord_high = $mol_coord_high;
4041
- function $mol_coord_low(key) {
4042
- return (key & 0xFFFF) << 16 >> 16;
4081
+ function $mol_coord_low(pack) {
4082
+ return (pack << 17) >> 17;
4043
4083
  }
4044
4084
  $.$mol_coord_low = $mol_coord_low;
4045
4085
  })($ || ($ = {}));
@@ -4125,6 +4165,12 @@ var $;
4125
4165
  const size_x = Math.max(0, Math.ceil((1 / aspect - 1) * diameter));
4126
4166
  return points.map(point => `M ${point[0] - shift_x} ${point[1] - shift_y} l ${size_x} ${size_y}`).join(' ');
4127
4167
  }
4168
+ dimensions() {
4169
+ const scale = this.scale();
4170
+ const radius = this.diameter() / Math.min(...scale) / 2;
4171
+ const dims = super.dimensions();
4172
+ return new this.$.$mol_vector_2d(new $mol_vector_range(dims.x.min - radius, dims.x.max + radius), new $mol_vector_range(dims.y.min - radius, dims.y.max + radius));
4173
+ }
4128
4174
  }
4129
4175
  __decorate([
4130
4176
  $mol_mem
@@ -4132,6 +4178,9 @@ var $;
4132
4178
  __decorate([
4133
4179
  $mol_mem
4134
4180
  ], $mol_plot_dot.prototype, "indexes", null);
4181
+ __decorate([
4182
+ $mol_mem
4183
+ ], $mol_plot_dot.prototype, "dimensions", null);
4135
4184
  $$.$mol_plot_dot = $mol_plot_dot;
4136
4185
  })($$ = $.$$ || ($.$$ = {}));
4137
4186
  })($ || ($ = {}));