molstar 3.0.0-dev.4 → 3.0.0-dev.5

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.
@@ -46,5 +46,6 @@ export declare class Mp4Controls extends PluginComponent {
46
46
  private syncInfo;
47
47
  private sync;
48
48
  private init;
49
+ private updateCanApply;
49
50
  constructor(plugin: PluginContext);
50
51
  }
@@ -124,16 +124,18 @@ var Mp4Controls = /** @class */ (function (_super) {
124
124
  });
125
125
  this.subscribe((_a = this.plugin.canvas3d) === null || _a === void 0 ? void 0 : _a.resized, function () { return _this.syncInfo(); });
126
126
  this.subscribe((_b = this.plugin.helpers.viewportScreenshot) === null || _b === void 0 ? void 0 : _b.events.previewed, function () { return _this.syncInfo(); });
127
- this.subscribe(this.plugin.behaviors.state.isBusy, function (b) {
128
- var _a, _b, _c;
129
- var anim = _this.current;
130
- if (!b && anim) {
131
- _this.behaviors.canApply.next((_c = (_b = (_a = anim.anim).canApply) === null || _b === void 0 ? void 0 : _b.call(_a, _this.plugin)) !== null && _c !== void 0 ? _c : { canApply: true });
132
- }
133
- });
127
+ this.subscribe(this.plugin.behaviors.state.isBusy, function (b) { return _this.updateCanApply(b); });
128
+ this.subscribe(this.plugin.managers.snapshot.events.changed, function (b) { return _this.updateCanApply(b); });
134
129
  this.sync();
135
130
  this.syncInfo();
136
131
  };
132
+ Mp4Controls.prototype.updateCanApply = function (b) {
133
+ var _a, _b, _c;
134
+ var anim = this.current;
135
+ if (!b && anim) {
136
+ this.behaviors.canApply.next((_c = (_b = (_a = anim.anim).canApply) === null || _b === void 0 ? void 0 : _b.call(_a, this.plugin)) !== null && _c !== void 0 ? _c : { canApply: true });
137
+ }
138
+ };
137
139
  return Mp4Controls;
138
140
  }(component_1.PluginComponent));
139
141
  exports.Mp4Controls = Mp4Controls;
@@ -393,7 +393,7 @@ var Canvas3D;
393
393
  return true;
394
394
  if (camera.transition.inTransition || nextCameraResetSnapshot)
395
395
  return false;
396
- var cameraSphereOverlapsNone = true;
396
+ var cameraSphereOverlapsNone = true, isEmpty = true;
397
397
  geometry_1.Sphere3D.set(cameraSphere, camera.state.target, camera.state.radius);
398
398
  // check if any renderable has moved outside of the old bounding sphere
399
399
  // and if no renderable is overlapping with the camera sphere
@@ -404,13 +404,14 @@ var Canvas3D;
404
404
  var b = r.values.boundingSphere.ref.value;
405
405
  if (!b.radius)
406
406
  continue;
407
+ isEmpty = false;
407
408
  var cameraDist = linear_algebra_1.Vec3.distance(cameraSphere.center, b.center);
408
409
  if ((cameraDist > cameraSphere.radius || cameraDist > b.radius || b.radius > camera.state.radiusMax) && !geometry_1.Sphere3D.includes(oldBoundingSphereVisible, b))
409
410
  return true;
410
411
  if (geometry_1.Sphere3D.overlaps(cameraSphere, b))
411
412
  cameraSphereOverlapsNone = false;
412
413
  }
413
- return cameraSphereOverlapsNone;
414
+ return cameraSphereOverlapsNone || (!isEmpty && cameraSphere.radius <= 0.1);
414
415
  }
415
416
  var sceneCommitTimeoutMs = 250;
416
417
  function commitScene(isSynchronous) {
@@ -46,5 +46,6 @@ export declare class Mp4Controls extends PluginComponent {
46
46
  private syncInfo;
47
47
  private sync;
48
48
  private init;
49
+ private updateCanApply;
49
50
  constructor(plugin: PluginContext);
50
51
  }
@@ -121,16 +121,18 @@ var Mp4Controls = /** @class */ (function (_super) {
121
121
  });
122
122
  this.subscribe((_a = this.plugin.canvas3d) === null || _a === void 0 ? void 0 : _a.resized, function () { return _this.syncInfo(); });
123
123
  this.subscribe((_b = this.plugin.helpers.viewportScreenshot) === null || _b === void 0 ? void 0 : _b.events.previewed, function () { return _this.syncInfo(); });
124
- this.subscribe(this.plugin.behaviors.state.isBusy, function (b) {
125
- var _a, _b, _c;
126
- var anim = _this.current;
127
- if (!b && anim) {
128
- _this.behaviors.canApply.next((_c = (_b = (_a = anim.anim).canApply) === null || _b === void 0 ? void 0 : _b.call(_a, _this.plugin)) !== null && _c !== void 0 ? _c : { canApply: true });
129
- }
130
- });
124
+ this.subscribe(this.plugin.behaviors.state.isBusy, function (b) { return _this.updateCanApply(b); });
125
+ this.subscribe(this.plugin.managers.snapshot.events.changed, function (b) { return _this.updateCanApply(b); });
131
126
  this.sync();
132
127
  this.syncInfo();
133
128
  };
129
+ Mp4Controls.prototype.updateCanApply = function (b) {
130
+ var _a, _b, _c;
131
+ var anim = this.current;
132
+ if (!b && anim) {
133
+ this.behaviors.canApply.next((_c = (_b = (_a = anim.anim).canApply) === null || _b === void 0 ? void 0 : _b.call(_a, this.plugin)) !== null && _c !== void 0 ? _c : { canApply: true });
134
+ }
135
+ };
134
136
  return Mp4Controls;
135
137
  }(PluginComponent));
136
138
  export { Mp4Controls };
@@ -391,7 +391,7 @@ var Canvas3D;
391
391
  return true;
392
392
  if (camera.transition.inTransition || nextCameraResetSnapshot)
393
393
  return false;
394
- var cameraSphereOverlapsNone = true;
394
+ var cameraSphereOverlapsNone = true, isEmpty = true;
395
395
  Sphere3D.set(cameraSphere, camera.state.target, camera.state.radius);
396
396
  // check if any renderable has moved outside of the old bounding sphere
397
397
  // and if no renderable is overlapping with the camera sphere
@@ -402,13 +402,14 @@ var Canvas3D;
402
402
  var b = r.values.boundingSphere.ref.value;
403
403
  if (!b.radius)
404
404
  continue;
405
+ isEmpty = false;
405
406
  var cameraDist = Vec3.distance(cameraSphere.center, b.center);
406
407
  if ((cameraDist > cameraSphere.radius || cameraDist > b.radius || b.radius > camera.state.radiusMax) && !Sphere3D.includes(oldBoundingSphereVisible, b))
407
408
  return true;
408
409
  if (Sphere3D.overlaps(cameraSphere, b))
409
410
  cameraSphereOverlapsNone = false;
410
411
  }
411
- return cameraSphereOverlapsNone;
412
+ return cameraSphereOverlapsNone || (!isEmpty && cameraSphere.radius <= 0.1);
412
413
  }
413
414
  var sceneCommitTimeoutMs = 250;
414
415
  function commitScene(isSynchronous) {
@@ -1,2 +1,2 @@
1
- export var PLUGIN_VERSION = '3.0.0-dev.4';
2
- export var PLUGIN_VERSION_DATE = new Date(typeof __MOLSTAR_DEBUG_TIMESTAMP__ !== 'undefined' ? __MOLSTAR_DEBUG_TIMESTAMP__ : 1639488302617);
1
+ export var PLUGIN_VERSION = '3.0.0-dev.5';
2
+ export var PLUGIN_VERSION_DATE = new Date(typeof __MOLSTAR_DEBUG_TIMESTAMP__ !== 'undefined' ? __MOLSTAR_DEBUG_TIMESTAMP__ : 1639653654516);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "molstar",
3
- "version": "3.0.0-dev.4",
3
+ "version": "3.0.0-dev.5",
4
4
  "description": "A comprehensive macromolecular library.",
5
5
  "homepage": "https://github.com/molstar/molstar#readme",
6
6
  "repository": {