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