@abi-software/scaffoldvuer 0.1.52-beta.2 → 0.1.52-beta.3

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;
@@ -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
  /**