@abi-software/scaffoldvuer 1.21.1-beta.4 → 2.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "1.21.1-beta.4",
3
+ "version": "2.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "engines": {
6
6
  "node": "^24.20.0"
@@ -21,6 +21,7 @@
21
21
  "changelog": "auto-changelog -p --output CHANGELOG.md --template keepachangelog",
22
22
  "version": "npm run build-bundle;npm run changelog; git add CHANGELOG.md",
23
23
  "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
24
+ "release:major": "npm version major; npm publish",
24
25
  "release:minor": "npm version minor; npm publish",
25
26
  "release:patch": "npm version patch; npm publish",
26
27
  "docs:dev": "vitepress dev docs",
@@ -58,7 +59,7 @@
58
59
  "simple-dropzone": "^0.8.3",
59
60
  "vue": "^3.5.41",
60
61
  "vue-router": "^5.2.0",
61
- "zincjs": "^2.4.1-beta.4"
62
+ "zincjs": "^3.0.0"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@babel/eslint-parser": "^8.0.1",
@@ -753,6 +753,16 @@ export default {
753
753
  type: Boolean,
754
754
  default: true,
755
755
  },
756
+ /**
757
+ * If this flag is set to true, renderer will only be redrawn when changes are
758
+ * made through ZincJS APIs or time is running. Any external change made to the scene will require
759
+ * invalidate() be called on object, region, scene and renderer in order to be redrawn.
760
+ *
761
+ */
762
+ renderOnDemand: {
763
+ type: Boolean,
764
+ default: true,
765
+ },
756
766
  /**
757
767
  * Specify the endpoint of the flatmap server.
758
768
  * This is used by annotation service included in
@@ -918,6 +928,7 @@ export default {
918
928
  isSearch: false,
919
929
  }),
920
930
  //checkedRegions: []
931
+ unwatchRenderOnDemand: null,
921
932
  unwatchURL: null,
922
933
  unwatchRegion: null,
923
934
  unwatchState: null,
@@ -1046,14 +1057,13 @@ export default {
1046
1057
  this.backgroundChangeCallback(this.currentBackground);
1047
1058
  });
1048
1059
  //Setup some watchers that depend on threejs init()
1049
- this.unwatchURL = this.$watch(
1050
- 'url',
1051
- (newVal) => {
1052
- if (this.state === undefined || this.state.url === undefined) {
1053
- this.setURL(newVal);
1054
- }
1060
+ this.unwatchRenderOnDemand = this.$watch(
1061
+ 'renderOnDemand',
1062
+ (renderOnDemand) => {
1063
+ //Older versions of ZincJS do not support render on demand
1064
+ this.$module.zincRenderer.setRenderOnDemand?.(renderOnDemand);
1055
1065
  },
1056
- { immediate: true }, // Runs immediately after creation, if desired
1066
+ { immediate: true },
1057
1067
  );
1058
1068
  this.unwatchRegion = this.$watch(
1059
1069
  'region',
@@ -1096,6 +1106,7 @@ export default {
1096
1106
  );
1097
1107
  },
1098
1108
  beforeUnmount: function () {
1109
+ if (this.unwatchRenderOnDemand) this.unwatchRenderOnDemand();
1099
1110
  if (this.unwatchURL) this.unwatchURL();
1100
1111
  if (this.unwatchRegion) this.unwatchRegion();
1101
1112
  if (this.unwatchState) this.unwatchState();
@@ -1292,6 +1303,8 @@ export default {
1292
1303
  backgroundChangeCallback: function (colour) {
1293
1304
  this.currentBackground = colour;
1294
1305
  this.$module.zincRenderer.getThreeJSRenderer().setClearColor(this.currentBackground, 1);
1306
+ //The clear colour is set on the THREE.js renderer directly
1307
+ this.$module.zincRenderer.invalidate?.();
1295
1308
  },
1296
1309
  /**
1297
1310
  * Internal only.
@@ -1316,6 +1329,8 @@ export default {
1316
1329
  camera.aspect = width / height;
1317
1330
  camera.updateProjectionMatrix();
1318
1331
  //this.$module.zincRenderer.onWindowResize();
1332
+ //Force a draw, the size and camera are changed directly
1333
+ this.$module.zincRenderer.invalidate?.();
1319
1334
  this.$module.zincRenderer.render();
1320
1335
  //renderer.render(this.$module.scene, camera);
1321
1336
 
@@ -1326,6 +1341,7 @@ export default {
1326
1341
  camera.aspect = originalAspect;
1327
1342
  camera.updateProjectionMatrix();
1328
1343
  //this.$module.zincRenderer.onWindowResize();
1344
+ this.$module.zincRenderer.invalidate?.();
1329
1345
  this.$module.zincRenderer.render();
1330
1346
  //renderer.render(this.$module.scene, camera);
1331
1347
 
@@ -1348,6 +1364,8 @@ export default {
1348
1364
  this.captureID = this.$module.zincRenderer.addPostRenderCallbackFunction(
1349
1365
  this.captureScreenshotCallback(filename, width, height),
1350
1366
  );
1367
+ //Post render callbacks only run when a frame is drawn
1368
+ this.$module.zincRenderer.invalidate?.();
1351
1369
  },
1352
1370
  /**
1353
1371
  * @public
@@ -3177,11 +3195,11 @@ export default {
3177
3195
  toggleRendering: function (flag) {
3178
3196
  if (this.$module.zincRenderer) {
3179
3197
  if (flag) {
3180
- // this.forceContextRestore();
3198
+ // this.forceContextRestore();
3181
3199
  this.$module.zincRenderer.animate();
3182
3200
  } else {
3183
3201
  this.$module.zincRenderer.stopAnimate();
3184
- // this.forceContextLoss();
3202
+ // this.forceContextLoss();
3185
3203
  }
3186
3204
  }
3187
3205
  },
@@ -125,6 +125,8 @@ RendererModule.prototype.setHighlightedByObjects = function (
125
125
  ) {
126
126
  const zincObjects = objectsToZincObjects(objects);
127
127
  const changed = this.graphicsHighlight.setHighlighted(objects);
128
+ //Some highlights are applied to THREE.js materials directly
129
+ if (changed) this.zincRenderer?.invalidate?.();
128
130
  if (propagateChanges) {
129
131
  let eventType = EVENT_TYPE.MOVE;
130
132
  if (changed) eventType = EVENT_TYPE.HIGHLIGHTED;
@@ -183,6 +185,8 @@ RendererModule.prototype.setSelectedByObjects = function (
183
185
  let changed;
184
186
  if (this.selectObjectOnPick) {
185
187
  changed = this.graphicsHighlight.setSelected(objects);
188
+ //Some highlights are applied to THREE.js materials directly
189
+ if (changed) this.zincRenderer?.invalidate?.();
186
190
  } else {
187
191
  changed = true;
188
192
  }
package/vite.config.js CHANGED
@@ -61,7 +61,8 @@ export default defineConfig(({ command }) => {
61
61
  '@abi-software/sparc-annotation': '@abi-software/sparc-annotation',
62
62
  '@abi-software/svg-sprite': '@abi-software/svg-sprite',
63
63
  '@abi-software/map-utilities': '@abi-software/map-utilities',
64
- '@abi-software/map-utilities/dist/style.css': '_abi_software_map_utilities_dist_style_css',
64
+ '@abi-software/map-utilities/dist/style.css':
65
+ '_abi_software_map_utilities_dist_style_css',
65
66
  pinia: 'pinia',
66
67
  },
67
68
  // keep css output name stable for the "./dist/style.css" export/import paths