@abi-software/scaffoldvuer 0.1.60 → 0.1.62

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-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -9836,6 +9836,11 @@
9836
9836
  "minipass": "^3.0.0"
9837
9837
  }
9838
9838
  },
9839
+ "minisearch": {
9840
+ "version": "6.0.1",
9841
+ "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-6.0.1.tgz",
9842
+ "integrity": "sha512-Ly1w0nHKnlhAAh6/BF/+9NgzXfoJxaJ8nhopFhQ3NcvFJrFIL+iCg9gw9e9UMBD+XIsp/RyznJ/o5UIe5Kw+kg=="
9843
+ },
9839
9844
  "minizlib": {
9840
9845
  "version": "2.1.2",
9841
9846
  "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/scaffoldvuer",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,6 +31,7 @@
31
31
  "element-ui": "^2.13.0",
32
32
  "google-spreadsheet": "^3.1.15",
33
33
  "lodash": "^4.17.21",
34
+ "minisearch": "^6.0.1",
34
35
  "query-string": "^6.11.1",
35
36
  "vue": "^2.6.10",
36
37
  "vue-custom-element": "^3.3.0",
package/src/App.vue CHANGED
@@ -14,6 +14,7 @@
14
14
  :display-u-i="displayUI"
15
15
  :url="url"
16
16
  :help-mode="helpMode"
17
+ :display-latest-changes="true"
17
18
  :display-minimap="displayMinimap"
18
19
  :display-markers="displayMarkers"
19
20
  :minimap-settings="minimapSettings"
@@ -29,6 +30,7 @@
29
30
  @zinc-object-added="objectAdded"
30
31
  />
31
32
  </drop-zone>
33
+
32
34
  <el-popover
33
35
  placement="bottom"
34
36
  trigger="click"
@@ -44,7 +46,7 @@
44
46
  class="app-row"
45
47
  :gutter="20"
46
48
  >
47
- <p v-if="currentTime!==0">
49
+ <p v-if="currentTime !== 0">
48
50
  time emited is: {{ currentTime.toFixed(2) }}
49
51
  </p>
50
52
  </el-row>
@@ -228,12 +230,13 @@
228
230
  type="textarea"
229
231
  autosize
230
232
  placeholder="Please input"
231
- style="padding-left:5%;width:90%;"
233
+ style="padding-left: 5%; width: 90%"
232
234
  />
233
235
  </div>
234
236
  <el-button
235
237
  slot="reference"
236
238
  icon="el-icon-setting"
239
+ @click="setSceneToWindo"
237
240
  >
238
241
  Options
239
242
  </el-button>
@@ -253,6 +256,17 @@
253
256
  >
254
257
  Models
255
258
  </el-button>
259
+ <el-autocomplete
260
+ slot="reference"
261
+ v-model="searchText"
262
+ class="search-box"
263
+ placeholder="Search"
264
+ :fetch-suggestions="fetchSuggestions"
265
+ :popper-append-to-body="false"
266
+ popper-class="autocomplete-popper"
267
+ @keyup.enter.native="search(searchText)"
268
+ @select="search(searchText)"
269
+ />
256
270
  </el-popover>
257
271
  </div>
258
272
  </template>
@@ -263,12 +277,22 @@ import { ScaffoldVuer } from "./components/index.js";
263
277
  import DropZone from "./components/DropZone.vue";
264
278
  import ModelsTable from "./components/ModelsTable.vue";
265
279
  import Vue from "vue";
266
- import { Button, Col, Icon, Input, InputNumber, Popover, Row, Switch } from "element-ui";
280
+ import {
281
+ Button,
282
+ Col,
283
+ Icon,
284
+ Input,
285
+ InputNumber,
286
+ Popover,
287
+ Row,
288
+ Switch,
289
+ Autocomplete,
290
+ } from "element-ui";
267
291
  import lang from "element-ui/lib/locale/lang/en";
268
292
  import locale from "element-ui/lib/locale";
269
- import taShader from "zincjs/src/shaders/textureArray.js"
270
- import volumeRender from "zincjs/src/shaders/volumeRender.js"
271
- import volumeTexture from "zincjs/src/shaders/volumeTexture.js"
293
+ import taShader from "zincjs/src/shaders/textureArray.js";
294
+ import volumeRender from "zincjs/src/shaders/volumeRender.js";
295
+ import volumeTexture from "zincjs/src/shaders/volumeTexture.js";
272
296
 
273
297
  locale.use(lang);
274
298
  Vue.use(Button);
@@ -279,27 +303,36 @@ Vue.use(InputNumber);
279
303
  Vue.use(Popover);
280
304
  Vue.use(Row);
281
305
  Vue.use(Switch);
306
+ Vue.use(Autocomplete);
282
307
 
283
308
  let texture_prefix = undefined;
284
309
 
285
310
  const getVolumeRender = (texture) => {
286
311
  const myUniforms = volumeRender.getUniforms();
287
- console.log(myUniforms)
288
- myUniforms.u_size.value.set(texture.size.width, texture.size.height, texture.size.depth);
312
+ console.log(myUniforms);
313
+ myUniforms.u_size.value.set(
314
+ texture.size.width,
315
+ texture.size.height,
316
+ texture.size.depth
317
+ );
289
318
  myUniforms.u_data.value = texture.impl;
290
319
  const options = {
291
320
  fs: volumeRender.fs,
292
321
  vs: volumeRender.vs,
293
322
  uniforms: myUniforms,
294
- glslVersion: volumeRender.glslVersion
323
+ glslVersion: volumeRender.glslVersion,
295
324
  };
296
325
  return options;
297
- }
326
+ };
298
327
 
299
328
  const getVolumeTexture = (texture) => {
300
329
  const myUniforms = volumeTexture.getUniforms();
301
- console.log(myUniforms)
302
- myUniforms.volume_scale.value.set(texture.size.width / texture.size.depth, texture.size.height / texture.size.depth, 1);
330
+ console.log(myUniforms);
331
+ myUniforms.volume_scale.value.set(
332
+ texture.size.width / texture.size.depth,
333
+ texture.size.height / texture.size.depth,
334
+ 1
335
+ );
303
336
  myUniforms.diffuse.value = texture.impl;
304
337
  myUniforms.depth.value = texture.size.depth;
305
338
  myUniforms.volume_dims.value = [200, 200, 200];
@@ -307,10 +340,10 @@ const getVolumeTexture = (texture) => {
307
340
  fs: volumeTexture.fs,
308
341
  vs: volumeTexture.vs,
309
342
  uniforms: myUniforms,
310
- glslVersion: volumeTexture.glslVersion
343
+ glslVersion: volumeTexture.glslVersion,
311
344
  };
312
345
  return options;
313
- }
346
+ };
314
347
 
315
348
  const getTestShader = (texture) => {
316
349
  const myUniforms = taShader.getUniforms();
@@ -320,11 +353,11 @@ const getTestShader = (texture) => {
320
353
  fs: taShader.fs,
321
354
  vs: taShader.vs,
322
355
  uniforms: myUniforms,
323
- glslVersion: taShader.glslVersion
356
+ glslVersion: taShader.glslVersion,
324
357
  };
325
- console.log(options)
358
+ console.log(options);
326
359
  return options;
327
- }
360
+ };
328
361
 
329
362
  const getTexture = async (scaffoldModule) => {
330
363
  const imgArray = [];
@@ -335,7 +368,7 @@ const getTexture = async (scaffoldModule) => {
335
368
  }
336
369
  await texture.loadFromImages(imgArray);
337
370
  return texture;
338
- }
371
+ };
339
372
 
340
373
  const testVolume = async (scaffoldModule, objects) => {
341
374
  if (objects) {
@@ -346,7 +379,7 @@ const testVolume = async (scaffoldModule, objects) => {
346
379
  console.log(material, texture, objects);
347
380
  objects[0].morph.material = material;
348
381
  }
349
- }
382
+ };
350
383
 
351
384
  const testSlides = async (scaffoldModule) => {
352
385
  const texture = await getTexture(scaffoldModule);
@@ -354,48 +387,44 @@ const testSlides = async (scaffoldModule) => {
354
387
  textureSlides.createSlides([
355
388
  {
356
389
  direction: "y",
357
- value: 0.1
390
+ value: 0.1,
358
391
  },
359
392
  {
360
393
  direction: "y",
361
- value: 0.3
394
+ value: 0.3,
362
395
  },
363
396
  {
364
397
  direction: "y",
365
- value: 0.5
398
+ value: 0.5,
366
399
  },
367
400
  {
368
401
  direction: "y",
369
- value: 0.7
402
+ value: 0.7,
370
403
  },
371
404
  {
372
405
  direction: "y",
373
- value: 0.9
406
+ value: 0.9,
374
407
  },
375
408
  {
376
409
  direction: "x",
377
- value: 0.5
410
+ value: 0.5,
378
411
  },
379
412
  {
380
413
  direction: "z",
381
- value: 0.5
414
+ value: 0.5,
382
415
  },
383
416
  ]);
384
417
  scaffoldModule.scene.addZincObject(textureSlides);
385
- }
386
-
418
+ };
387
419
 
388
420
  export default {
389
421
  name: "App",
390
422
  components: {
391
423
  DropZone,
392
424
  ScaffoldVuer,
393
- ModelsTable
394
- },
395
- created: function() {
396
- texture_prefix = process.env.VUE_APP_TEXTURE_FOOT_PREFIX;
425
+ ModelsTable,
397
426
  },
398
- data: function() {
427
+ data: function () {
399
428
  return {
400
429
  url: undefined,
401
430
  input: undefined,
@@ -413,7 +442,7 @@ export default {
413
442
  y_offset: 50,
414
443
  width: 128,
415
444
  height: 128,
416
- align: "top-right"
445
+ align: "top-right",
417
446
  },
418
447
  render: true,
419
448
  region: "",
@@ -424,86 +453,113 @@ export default {
424
453
  pos: [0, 0],
425
454
  format: "metadata",
426
455
  sceneSettings: [],
427
-
456
+ searchInput: "",
457
+ searchText: "",
428
458
  };
429
459
  },
430
460
  watch: {
431
- input: function() {
461
+ input: function () {
432
462
  this.parseInput();
433
463
  },
434
- tumbleOn: function(val) {
464
+ tumbleOn: function (val) {
435
465
  this.autoTumble(val);
436
466
  },
437
467
  "$route.query": {
438
468
  handler: "parseQuery",
439
469
  deep: true,
440
- immediate: true
470
+ immediate: true,
441
471
  },
442
- syncMode: function(val) {
472
+ syncMode: function (val) {
443
473
  this.$refs.scaffold.toggleSyncControl(val);
444
- }
474
+ },
445
475
  },
446
- mounted: function() {
476
+ mounted: function () {
447
477
  this._objects = [];
448
- this.selectedCoordinates = this.$refs.scaffold.getDynamicSelectedCoordinates();
478
+ this.selectedCoordinates =
479
+ this.$refs.scaffold.getDynamicSelectedCoordinates();
449
480
  this.rendererInfo = this.$refs.scaffold.getRendererInfo();
450
481
  },
482
+ created: function () {
483
+ texture_prefix = process.env.VUE_APP_TEXTURE_FOOT_PREFIX;
484
+ },
451
485
  methods: {
452
- exportGLTF: function() {
453
- this.$refs.scaffold.exportGLTF(false)
454
- .then(data =>{
455
- let dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(data));
456
- let hrefElement = document.createElement("a");
457
- document.body.append(hrefElement);
458
- hrefElement.download = `export.gltf`;
459
- hrefElement.href = dataStr;
460
- hrefElement.click();
461
- hrefElement.remove();
462
- })
486
+ exportGLTF: function () {
487
+ this.$refs.scaffold.exportGLTF(false).then((data) => {
488
+ let dataStr =
489
+ "data:text/json;charset=utf-8," +
490
+ encodeURIComponent(JSON.stringify(data));
491
+ let hrefElement = document.createElement("a");
492
+ document.body.append(hrefElement);
493
+ hrefElement.download = `export.gltf`;
494
+ hrefElement.href = dataStr;
495
+ hrefElement.click();
496
+ hrefElement.remove();
497
+ });
463
498
  },
464
- exportGLB: function() {
465
- this.$refs.scaffold.exportGLTF(true)
466
- .then(data =>{
467
- let blob = new Blob([data], {type: "octet/stream"});
468
- let url = window.URL.createObjectURL(blob);
469
- let hrefElement = document.createElement("a");
470
- document.body.append(hrefElement);
471
- hrefElement.download = `export.glb`;
472
- hrefElement.href = url;
473
- hrefElement.click();
474
- hrefElement.remove();
475
- })
499
+ exportGLB: function () {
500
+ this.$refs.scaffold.exportGLTF(true).then((data) => {
501
+ let blob = new Blob([data], { type: "octet/stream" });
502
+ let url = window.URL.createObjectURL(blob);
503
+ let hrefElement = document.createElement("a");
504
+ document.body.append(hrefElement);
505
+ hrefElement.download = `export.glb`;
506
+ hrefElement.href = url;
507
+ hrefElement.click();
508
+ hrefElement.remove();
509
+ });
476
510
  },
477
- objectAdded: function(zincObject) {
478
- console.log(zincObject)
511
+ objectAdded: function (zincObject) {
512
+ console.log(zincObject);
479
513
  this._objects.push(zincObject);
480
514
  },
481
- featureTesting: async function() {
515
+ featureTesting: async function () {
482
516
  //Test texture
483
517
  testVolume(this.$refs.scaffold.$module, this._objects);
484
-
485
-
486
518
  },
487
- featureTesting2: async function() {
519
+ featureTesting2: async function () {
488
520
  //Test texture
489
521
  //testVolume(this.$refs.scaffold.$module, this._objects);
490
522
  testSlides(this.$refs.scaffold.$module);
491
523
  },
492
- saveSettings: function() {
524
+ saveSettings: function () {
493
525
  this.sceneSettings.push(this.$refs.scaffold.getState());
494
526
  },
495
- restoreSettings: function() {
527
+ restoreSettings: function () {
496
528
  if (this.sceneSettings.length > 0)
497
529
  this.$refs.scaffold.setState(this.sceneSettings.pop());
498
530
  },
499
- viewModelClicked: function(location) {
531
+ viewModelClicked: function (location) {
500
532
  this.input = location;
501
533
  },
502
- screenCapture: function() {
534
+ screenCapture: function () {
503
535
  this.$refs.scaffold.captureScreenshot("capture.png");
504
536
  },
505
- autoTumble: function(flag) {
506
- let cameracontrol = this.$refs.scaffold.$module.scene.getZincCameraControls();
537
+ setSceneToWindo: function () {
538
+ window.scene = this.$refs.scaffold.$module.scene;
539
+ },
540
+ search: function (term) {
541
+ this.$refs.scaffold.search(term, true);
542
+ },
543
+ fetchSuggestions: function (term, cb) {
544
+ if ( term === "" || !this.$refs.scaffold ) {
545
+ cb([]);
546
+ }
547
+ cb(
548
+ this.$refs.scaffold.fetchSuggestions(term).map((item) => {
549
+ return {
550
+ value: item.suggestion,
551
+ label: item.suggestion,
552
+ };
553
+ })
554
+ );
555
+ console.log(
556
+ "found suggestions",
557
+ this.$refs.scaffold.fetchSuggestions(term)
558
+ );
559
+ },
560
+ autoTumble: function (flag) {
561
+ let cameracontrol =
562
+ this.$refs.scaffold.$module.scene.getZincCameraControls();
507
563
  if (flag) {
508
564
  this.displayUI = false;
509
565
  cameracontrol.enableAutoTumble();
@@ -513,45 +569,44 @@ export default {
513
569
  cameracontrol.stopAutoTumble();
514
570
  }
515
571
  },
516
- onReady: function() {
517
- console.log("ready")
572
+ onReady: function () {
573
+ console.log("ready");
518
574
  //window.scaffoldvuer = this.$refs.scaffold;
519
575
  this.$refs.dropzone.revokeURLs();
520
- const names = ["left ventricle.mesh2d", "right ventricle.mesh2d"];
521
- this.$refs.scaffold.changeActiveByName(names, "", false);
522
576
  },
523
- onSelected: function(data) {
524
- if (data && (data.length > 0) && data[0].data.group) {
577
+ onSelected: function (data) {
578
+ console.log(data);
579
+ if (data && data.length > 0 && data[0].data.group) {
525
580
  delete this.$route.query["viewURL"];
526
- this.$router.replace({
527
- query: { ...this.$route.query, region: data[0].data.group }
528
- });
581
+ this.$refs.scaffold.showRegionTooltip(data[0].data.group, true, true);
582
+ //this.$router.replace({
583
+ // query: { ...this.$route.query, region: data[0].data.group }
584
+ //});
529
585
  }
530
586
  },
531
- onNavigated: function(data) {
587
+ onNavigated: function (data) {
532
588
  this.zoom = data.zoom;
533
589
  this.pos[0] = data.target[0];
534
590
  this.pos[1] = data.target[1];
535
591
  },
536
- onFilesDrop: function(payload) {
592
+ onFilesDrop: function (payload) {
537
593
  if (payload.format == "gltf") this.format = "gltf";
538
594
  else this.format = "metadata";
539
595
  this.input = payload.url;
540
596
  },
541
- parseInput: function() {
597
+ parseInput: function () {
542
598
  if (this.$route.query.url !== this.input) {
543
- const queries = {...this.$route.query};
544
- if (this.input && this.input !== "")
545
- queries.url = this.input;
599
+ const queries = { ...this.$route.query };
600
+ if (this.input && this.input !== "") queries.url = this.input;
546
601
  this.$router.replace({
547
- query: { ...this.$route.query, url: this.input }
602
+ query: { ...this.$route.query, url: this.input },
548
603
  });
549
604
  }
550
605
  },
551
- updateCurrentTime: function(val) {
606
+ updateCurrentTime: function (val) {
552
607
  this.currentTime = val;
553
608
  },
554
- parseQuery: function(query) {
609
+ parseQuery: function (query) {
555
610
  if (query.url != this.url) {
556
611
  this._objects = [];
557
612
  }
@@ -577,8 +632,8 @@ export default {
577
632
  } else {
578
633
  this.viewURL = "";
579
634
  }
580
- }
581
- }
635
+ },
636
+ },
582
637
  };
583
638
  </script>
584
639
 
@@ -650,6 +705,4 @@ body {
650
705
  svg.map-icon {
651
706
  color: $app-primary-color;
652
707
  }
653
-
654
-
655
708
  </style>