@abi-software/scaffoldvuer 0.1.52-beta.1 → 0.1.52-beta.4

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.
@@ -58,7 +58,6 @@ RendererModule.prototype.getIntersectedObject = function(intersects) {
58
58
 
59
59
  RendererModule.prototype.getAnnotationsFromObjects = function(objects) {
60
60
  const annotations = [];
61
- let count = 0;
62
61
  for (var i = 0; i < objects.length; i++) {
63
62
  const zincObject = objects[i].userData;
64
63
  let annotation = undefined;
@@ -67,7 +66,7 @@ RendererModule.prototype.getAnnotationsFromObjects = function(objects) {
67
66
  const glyphset = zincObject;
68
67
  if (zincObject.isGlyph)
69
68
  glyphset = zincObject.getGlyphset();
70
- annotation = glyphset.userData ? glyphset.userData[0] : undefined;
69
+ annotation = glyphset.userData ? glyphset.userData.annotation : undefined;
71
70
  if (annotation && annotation.data) {
72
71
  if (objects[i].name && objects[i].name != "")
73
72
  annotation.data.id = objects[i].name;
@@ -75,23 +74,28 @@ RendererModule.prototype.getAnnotationsFromObjects = function(objects) {
75
74
  annotation.data.id = glyphset.groupName;
76
75
  }
77
76
  } else {
78
- annotation = zincObject.userData ? zincObject.userData[0] : undefined;
77
+ annotation = zincObject.userData ? zincObject.userData.annotation : undefined;
79
78
  if (annotation && annotation.data){
80
79
  annotation.data.id = objects[i].name;
81
80
  }
82
81
  }
83
82
  }
84
83
  if (annotation)
85
- annotations[count++] = annotation;
84
+ annotations.push(annotation);
86
85
  }
87
86
  return annotations;
88
87
  }
89
88
 
90
- RendererModule.prototype.setHighlightedByObjects = function(objects, propagateChanges) {
89
+ RendererModule.prototype.setHighlightedByObjects = function(
90
+ objects, coords, propagateChanges) {
91
91
  const changed = this.graphicsHighlight.setHighlighted(objects);
92
- if (changed && propagateChanges) {
93
- const eventType = require("./eventNotifier").EVENT_TYPE.HIGHLIGHTED;
92
+ if (propagateChanges) {
93
+ eventType = require("./eventNotifier").EVENT_TYPE.MOVE;
94
+ if (changed)
95
+ eventType = require("./eventNotifier").EVENT_TYPE.HIGHLIGHTED;
94
96
  const annotations = this.getAnnotationsFromObjects(objects);
97
+ if (annotations.length > 0)
98
+ annotations[0].coords = coords;
95
99
  this.publishChanges(annotations, eventType);
96
100
  }
97
101
  return changed;
@@ -99,8 +103,8 @@ RendererModule.prototype.setHighlightedByObjects = function(objects, propagateCh
99
103
 
100
104
 
101
105
  RendererModule.prototype.setHighlightedByZincObject = function(
102
- zincObject, propagateChanges) {
103
- return this.setHighlightedByObjects([zincObject ? zincObject.morph : undefined], propagateChanges);
106
+ zincObject, coords, propagateChanges) {
107
+ return this.setHighlightedByObjects([zincObject ? zincObject.morph : undefined], coords,propagateChanges);
104
108
  }
105
109
 
106
110
  RendererModule.prototype.setupLiveCoordinates = function(zincObjects) {
@@ -139,7 +143,7 @@ RendererModule.prototype.objectsToZincObjects = function(objects) {
139
143
 
140
144
 
141
145
  RendererModule.prototype.setSelectedByObjects = function(
142
- objects, propagateChanges) {
146
+ objects, coords, propagateChanges) {
143
147
  const changed = this.graphicsHighlight.setSelected(objects);
144
148
  if (changed) {
145
149
  const zincObjects = this.objectsToZincObjects(objects);
@@ -147,6 +151,8 @@ RendererModule.prototype.setSelectedByObjects = function(
147
151
  if (propagateChanges) {
148
152
  const eventType = require("./eventNotifier").EVENT_TYPE.SELECTED;
149
153
  const annotations = this.getAnnotationsFromObjects(objects);
154
+ if (annotations.length > 0)
155
+ annotations[0].coords = coords;
150
156
  this.publishChanges(annotations, eventType);
151
157
  }
152
158
  }
@@ -154,8 +160,9 @@ RendererModule.prototype.setSelectedByObjects = function(
154
160
  }
155
161
 
156
162
  RendererModule.prototype.setSelectedByZincObject = function(
157
- zincObject, propagateChanges) {
158
- return this.setSelectedByObjects([zincObject ? zincObject.morph : undefined], propagateChanges);
163
+ zincObject, coords, propagateChanges) {
164
+ return this.setSelectedByObjects([zincObject ? zincObject.morph : undefined],
165
+ coords, propagateChanges);
159
166
  }
160
167
 
161
168
  const addGlyphToArray = function(objects) {
@@ -180,12 +187,12 @@ RendererModule.prototype.findObjectsByGroupName = function(groupName) {
180
187
 
181
188
  RendererModule.prototype.setHighlightedByGroupName = function(groupName, propagateChanges) {
182
189
  const objects = this.findObjectsByGroupName(groupName);
183
- return this.setHighlightedByObjects(objects, propagateChanges);
190
+ return this.setHighlightedByObjects(objects, undefined, propagateChanges);
184
191
  }
185
192
 
186
193
  RendererModule.prototype.setSelectedByGroupName = function(groupName, propagateChanges) {
187
194
  const objects = this.findObjectsByGroupName(groupName);
188
- return this.setSelectedByObjects(objects, propagateChanges);
195
+ return this.setSelectedByObjects(objects, undefined, propagateChanges);
189
196
  }
190
197
 
191
198
  RendererModule.prototype.changeBackgroundColour = function(backgroundColourString) {
@@ -1,4 +1,4 @@
1
- const EVENT_TYPE = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2 };
1
+ const EVENT_TYPE = { ALL: 0, SELECTED: 1, HIGHLIGHTED: 2, MOVE: 3 };
2
2
 
3
3
  const SelectionEvent = function(eventTypeIn, identifiersIn) {
4
4
  this.eventType = eventTypeIn;
@@ -90,7 +90,18 @@ const OrgansSceneData = function() {
90
90
  cameraControl.resetView();
91
91
  this.NDCCameraControl = cameraControl.enableSyncControl();
92
92
  } else {
93
- this.NDCCameraControl = cameraControl.disableSyncControl();
93
+ cameraControl.disableSyncControl();
94
+ this.NDCCameraControl = undefined;
95
+ }
96
+ }
97
+
98
+ this.isSyncControl = () => {
99
+ return this.NDCCameraControl !== undefined;
100
+ }
101
+
102
+ this.setSyncControlZoomToBox = (box) => {
103
+ if (this.NDCCameraControl) {
104
+ this.NDCCameraControl.zoomToBox(box, 2);
94
105
  }
95
106
  }
96
107
 
@@ -208,18 +219,20 @@ const OrgansSceneData = function() {
208
219
  return function(intersects, window_x, window_y) {
209
220
  const intersected = _this.getIntersectedObject(intersects);
210
221
  const idObject = getIdObjectFromIntersect(intersected);
222
+ const coords = { x: window_x, y: window_y };
211
223
  if (idObject.id) {
212
- if (idObject.object.userData.isGlyph) {
224
+ if (idObject.object.userData.isGlyph) {
213
225
  if (idObject.object.name)
214
- _this.setSelectedByObjects([idObject.object], true);
226
+ _this.setSelectedByObjects([idObject.object], coords, true);
215
227
  else
216
- _this.setSelectedByZincObject(idObject.object.userData.getGlyphset(), true);
228
+ _this.setSelectedByZincObject(idObject.object.userData.getGlyphset(),
229
+ coords, true);
217
230
  } else {
218
- _this.setSelectedByObjects([idObject.object], true);
231
+ _this.setSelectedByObjects([idObject.object], coords, true);
219
232
  }
220
233
  return;
221
234
  } else {
222
- _this.setSelectedByObjects([], true);
235
+ _this.setSelectedByObjects([], coords, true);
223
236
  }
224
237
  }
225
238
  };
@@ -233,14 +246,15 @@ const OrgansSceneData = function() {
233
246
  return function(intersects, window_x, window_y) {
234
247
  const intersected = _this.getIntersectedObject(intersects);
235
248
  const idObject = getIdObjectFromIntersect(intersected);
249
+ const coords = { x: window_x, y: window_y };
236
250
  if (idObject.id) {
237
251
  _this.displayArea.style.cursor = "pointer";
238
- _this.setHighlightedByObjects([idObject.object], true);
252
+ _this.setHighlightedByObjects([idObject.object], coords, true);
239
253
  return;
240
254
  }
241
255
  else {
242
256
  _this.displayArea.style.cursor = "auto";
243
- _this.setHighlightedByObjects([], true);
257
+ _this.setHighlightedByObjects([], coords, true);
244
258
  }
245
259
  }
246
260
  };
@@ -335,37 +349,29 @@ const OrgansSceneData = function() {
335
349
  }
336
350
 
337
351
  const addOrganPartToSceneData = function(zincObject) {
338
- if (zincObject.groupName) {
339
- if (zincObject.isGeometry) {
340
- if (!_this.sceneData.geometries.includes(zincObject.groupName)) {
341
- _this.sceneData.geometries.push(zincObject.groupName);
342
- }
343
- } else if (zincObject.isGlyphset) {
344
- if (!_this.sceneData.glyphsets.includes(zincObject.groupName)) {
345
- _this.sceneData.glyphsets.push(zincObject.groupName);
346
- }
347
- } else if (zincObject.isLines) {
348
- if (!_this.sceneData.lines.includes(zincObject.groupName)) {
349
- _this.sceneData.lines.push(zincObject.groupName);
350
- }
351
- } else if (zincObject.isPointset) {
352
- if (!_this.sceneData.pointsets.includes(zincObject.groupName)) {
353
- _this.sceneData.pointsets.push(zincObject.groupName);
354
- }
355
- }
356
- }
352
+ if (zincObject.isGeometry) {
353
+ _this.sceneData.geometries.push(zincObject);
354
+ } else if (zincObject.isGlyphset) {
355
+ _this.sceneData.glyphsets.push(zincObject);
356
+ } else if (zincObject.isLines) {
357
+ _this.sceneData.lines.push(zincObject);
358
+ } else if (zincObject.isPointset) {
359
+ _this.sceneData.pointsets.push(zincObject);
360
+ }
357
361
  }
358
362
 
359
363
  const addOrganPart = function(systemName, partName, useDefautColour, zincObject) {
360
364
  for (let i = 0; i < organPartAddedCallbacks.length;i++) {
361
- organPartAddedCallbacks[i](zincObject.groupName, _this.scene.isTimeVarying(), zincObject);
365
+ organPartAddedCallbacks[i](zincObject, _this.scene.isTimeVarying());
362
366
  }
363
367
  if (useDefautColour)
364
368
  modelsLoader.setGeometryColour(zincObject, systemName, partName);
365
369
  addOrganPartToSceneData(zincObject);
366
370
  const annotation = new (require('./annotation').annotation)();
367
- annotation.data = {species:_this.sceneData.currentSpecies, system:systemName, part:partName, group:zincObject.groupName};
368
- zincObject.userData = [annotation];
371
+ const region = zincObject.region.getFullPath();
372
+ annotation.data = {species:_this.sceneData.currentSpecies, system:systemName,
373
+ part:partName, group:zincObject.groupName, region: region};
374
+ zincObject.userData["annotation"] = annotation;
369
375
  }
370
376
 
371
377
  /**