@kitware/vtk.js 24.2.2 → 24.4.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/IO/Core/HttpDataSetReader.d.ts +58 -0
- package/IO/Core/HttpDataSetReader.js +24 -2
- package/Rendering/Core/RenderWindowInteractor.js +16 -4
- package/Rendering/Core/ScalarBarActor.d.ts +24 -0
- package/Rendering/Core/ScalarBarActor.js +2 -2
- package/Widgets/Core/WidgetManager.js +125 -100
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +17 -8
- package/index.d.ts +2 -2
- package/macros.d.ts +12 -0
- package/macros.js +16 -1
- package/package.json +1 -1
|
@@ -28,6 +28,56 @@ export interface IHttpDataSetReaderArray {
|
|
|
28
28
|
enable: boolean;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
export interface IRange {
|
|
32
|
+
max: number,
|
|
33
|
+
component: unknown,
|
|
34
|
+
min: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface IPointDataArray {
|
|
38
|
+
data: {
|
|
39
|
+
numberOfComponents: number,
|
|
40
|
+
name: string,
|
|
41
|
+
vtkClass: string,
|
|
42
|
+
dataType: string,
|
|
43
|
+
ranges: Array<IRange>,
|
|
44
|
+
ref: {
|
|
45
|
+
registration: string,
|
|
46
|
+
encode: string,
|
|
47
|
+
basepath: string,
|
|
48
|
+
id: string
|
|
49
|
+
},
|
|
50
|
+
size: number
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface IDatasetManifest {
|
|
55
|
+
origin: [number, number, number],
|
|
56
|
+
cellData: {
|
|
57
|
+
arrays: Array<unknown>,
|
|
58
|
+
vtkClass: string
|
|
59
|
+
},
|
|
60
|
+
FieldData: {
|
|
61
|
+
arrays: Array<unknown>,
|
|
62
|
+
vtkClass: string,
|
|
63
|
+
},
|
|
64
|
+
vtkClass: string,
|
|
65
|
+
pointData: {
|
|
66
|
+
arrays: Array<IPointDataArray>,
|
|
67
|
+
vtkClass: string
|
|
68
|
+
},
|
|
69
|
+
spacing: [number, number, number],
|
|
70
|
+
extent: [number, number, number, number, number, number],
|
|
71
|
+
direction: [number, number, number, number, number, number, number, number, number],
|
|
72
|
+
metadata?: Record<string, unknown>
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface IParseObjectOptions {
|
|
76
|
+
loadData: boolean,
|
|
77
|
+
baseUrl: string,
|
|
78
|
+
deepCopy: boolean
|
|
79
|
+
}
|
|
80
|
+
|
|
31
81
|
type vtkHttpDataSetReaderBase = vtkObject & Omit<vtkAlgorithm,
|
|
32
82
|
| 'getInputData'
|
|
33
83
|
| 'setInputData'
|
|
@@ -166,6 +216,14 @@ export interface vtkHttpDataSetReader extends vtkHttpDataSetReaderBase {
|
|
|
166
216
|
*/
|
|
167
217
|
setUrl(url: string, option?: IHttpDataSetReaderOptions): Promise<any>;
|
|
168
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Set the dataset object to use for data fetching.
|
|
221
|
+
*
|
|
222
|
+
* @param {IDatasetManifest} manifest The dataset manifest object
|
|
223
|
+
* @param {IParseObjectOptions} options
|
|
224
|
+
*/
|
|
225
|
+
parseObject(manifest: IDatasetManifest, options: IParseObjectOptions): Promise<void>;
|
|
226
|
+
|
|
169
227
|
/**
|
|
170
228
|
*
|
|
171
229
|
*/
|
|
@@ -159,7 +159,10 @@ function vtkHttpDataSetReader(publicAPI, model) {
|
|
|
159
159
|
callback: function callback(zip) {
|
|
160
160
|
model.baseURL = '';
|
|
161
161
|
model.dataAccessHelper.fetchJSON(publicAPI, 'index.json').then(function (dataset) {
|
|
162
|
-
|
|
162
|
+
publicAPI.parseObject(dataset, {
|
|
163
|
+
loadData: loadData,
|
|
164
|
+
deepCopy: false
|
|
165
|
+
}).then(resolve, reject);
|
|
163
166
|
}, function (error) {
|
|
164
167
|
reject(error);
|
|
165
168
|
});
|
|
@@ -173,7 +176,10 @@ function vtkHttpDataSetReader(publicAPI, model) {
|
|
|
173
176
|
|
|
174
177
|
return new Promise(function (resolve, reject) {
|
|
175
178
|
model.dataAccessHelper.fetchJSON(publicAPI, model.url).then(function (dataset) {
|
|
176
|
-
|
|
179
|
+
publicAPI.parseObject(dataset, {
|
|
180
|
+
loadData: loadData,
|
|
181
|
+
deepCopy: false
|
|
182
|
+
}).then(resolve, reject);
|
|
177
183
|
}, function (error) {
|
|
178
184
|
reject(error);
|
|
179
185
|
});
|
|
@@ -198,6 +204,22 @@ function vtkHttpDataSetReader(publicAPI, model) {
|
|
|
198
204
|
model.compression = options.compression; // Fetch metadata
|
|
199
205
|
|
|
200
206
|
return publicAPI.updateMetadata(!!options.loadData);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
publicAPI.parseObject = function (manifest, _ref) {
|
|
210
|
+
var loadData = _ref.loadData,
|
|
211
|
+
baseUrl = _ref.baseUrl,
|
|
212
|
+
_ref$deepCopy = _ref.deepCopy,
|
|
213
|
+
deepCopy = _ref$deepCopy === void 0 ? true : _ref$deepCopy;
|
|
214
|
+
|
|
215
|
+
if (baseUrl) {
|
|
216
|
+
model.baseURL = baseUrl;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
var dataset = deepCopy ? structuredClone(manifest) : manifest;
|
|
220
|
+
return new Promise(function (resolve, reject) {
|
|
221
|
+
processDataSet(publicAPI, model, dataset, fetchArray, resolve, reject, loadData);
|
|
222
|
+
});
|
|
201
223
|
}; // Fetch the actual data arrays
|
|
202
224
|
|
|
203
225
|
|
|
@@ -184,8 +184,14 @@ function vtkRenderWindowInteractor(publicAPI, model) {
|
|
|
184
184
|
rootElm[method]('mouseup', publicAPI.handleMouseUp);
|
|
185
185
|
rootElm[method]('mousemove', publicAPI.handleMouseMove);
|
|
186
186
|
rootElm[method]('touchend', publicAPI.handleTouchEnd, false);
|
|
187
|
-
rootElm[method]('touchcancel', publicAPI.handleTouchEnd,
|
|
188
|
-
|
|
187
|
+
rootElm[method]('touchcancel', publicAPI.handleTouchEnd, {
|
|
188
|
+
passive: false,
|
|
189
|
+
capture: false
|
|
190
|
+
});
|
|
191
|
+
rootElm[method]('touchmove', publicAPI.handleTouchMove, {
|
|
192
|
+
passive: false,
|
|
193
|
+
capture: false
|
|
194
|
+
});
|
|
189
195
|
}
|
|
190
196
|
|
|
191
197
|
if (!force && addListeners) {
|
|
@@ -207,7 +213,10 @@ function vtkRenderWindowInteractor(publicAPI, model) {
|
|
|
207
213
|
document.addEventListener('keydown', publicAPI.handleKeyDown);
|
|
208
214
|
document.addEventListener('keyup', publicAPI.handleKeyUp);
|
|
209
215
|
document.addEventListener('pointerlockchange', publicAPI.handlePointerLockChange);
|
|
210
|
-
container.addEventListener('touchstart', publicAPI.handleTouchStart,
|
|
216
|
+
container.addEventListener('touchstart', publicAPI.handleTouchStart, {
|
|
217
|
+
passive: false,
|
|
218
|
+
capture: false
|
|
219
|
+
});
|
|
211
220
|
};
|
|
212
221
|
|
|
213
222
|
publicAPI.unbindEvents = function () {
|
|
@@ -225,7 +234,10 @@ function vtkRenderWindowInteractor(publicAPI, model) {
|
|
|
225
234
|
document.removeEventListener('keydown', publicAPI.handleKeyDown);
|
|
226
235
|
document.removeEventListener('keyup', publicAPI.handleKeyUp);
|
|
227
236
|
document.removeEventListener('pointerlockchange', publicAPI.handlePointerLockChange);
|
|
228
|
-
model.container.removeEventListener('touchstart', publicAPI.handleTouchStart
|
|
237
|
+
model.container.removeEventListener('touchstart', publicAPI.handleTouchStart, {
|
|
238
|
+
passive: false,
|
|
239
|
+
capture: false
|
|
240
|
+
});
|
|
229
241
|
model.container = null;
|
|
230
242
|
};
|
|
231
243
|
|
|
@@ -223,6 +223,30 @@ export interface vtkScalarBarActor extends vtkActor {
|
|
|
223
223
|
*/
|
|
224
224
|
setBoxSizeFrom(boxSize: Size): boolean;
|
|
225
225
|
|
|
226
|
+
/**
|
|
227
|
+
*
|
|
228
|
+
* @param {Vector2} barPosition
|
|
229
|
+
*/
|
|
230
|
+
setBarPosition(barPosition: Vector2): boolean;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
*
|
|
234
|
+
* @param {Vector2} barPosition
|
|
235
|
+
*/
|
|
236
|
+
setBarPositionFrom(barPosition: Vector2): boolean;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
*
|
|
240
|
+
* @param {Size} barSize
|
|
241
|
+
*/
|
|
242
|
+
setBarSize(barSize: Size): boolean;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
*
|
|
246
|
+
* @param {Size} barSize
|
|
247
|
+
*/
|
|
248
|
+
setBarSizeFrom(barSize: Size): boolean;
|
|
249
|
+
|
|
226
250
|
/**
|
|
227
251
|
*
|
|
228
252
|
* @param {vtkScalarsToColors} scalarsToColors
|
|
@@ -787,8 +787,8 @@ function extend(publicAPI, model) {
|
|
|
787
787
|
publicAPI.getProperty().setAmbient(1.0);
|
|
788
788
|
macro.setGet(publicAPI, model, ['automated', 'autoLayout', 'axisTitlePixelOffset', 'axisLabel', 'scalarsToColors', 'tickLabelPixelOffset', 'drawNanAnnotation', 'drawBelowRangeSwatch', 'drawAboveRangeSwatch']);
|
|
789
789
|
macro.get(publicAPI, model, ['axisTextStyle', 'tickTextStyle']);
|
|
790
|
-
macro.getArray(publicAPI, model, ['boxPosition', 'boxSize']);
|
|
791
|
-
macro.setArray(publicAPI, model, ['boxPosition', 'boxSize'], 2); // Object methods
|
|
790
|
+
macro.getArray(publicAPI, model, ['barPosition', 'barSize', 'boxPosition', 'boxSize']);
|
|
791
|
+
macro.setArray(publicAPI, model, ['barPosition', 'barSize', 'boxPosition', 'boxSize'], 2); // Object methods
|
|
792
792
|
|
|
793
793
|
vtkScalarBarActor(publicAPI, model);
|
|
794
794
|
} // ----------------------------------------------------------------------------
|
|
@@ -7,6 +7,7 @@ import macro from '../../macros.js';
|
|
|
7
7
|
import vtkSelectionNode from '../../Common/DataModel/SelectionNode.js';
|
|
8
8
|
import WidgetManagerConst from './WidgetManager/Constants.js';
|
|
9
9
|
import vtkSVGRepresentation from '../SVG/SVGRepresentation.js';
|
|
10
|
+
import { WIDGET_PRIORITY } from './AbstractWidget/Constants.js';
|
|
10
11
|
import { diff } from './WidgetManager/vdom.js';
|
|
11
12
|
|
|
12
13
|
var ViewTypes = WidgetManagerConst.ViewTypes,
|
|
@@ -263,6 +264,110 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
263
264
|
// --------------------------------------------------------------------------
|
|
264
265
|
|
|
265
266
|
|
|
267
|
+
function updateSelection(_x) {
|
|
268
|
+
return _updateSelection.apply(this, arguments);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function _updateSelection() {
|
|
272
|
+
_updateSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref) {
|
|
273
|
+
var position, _yield$publicAPI$getS, requestCount, selectedState, representation, widget, i, w;
|
|
274
|
+
|
|
275
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
276
|
+
while (1) {
|
|
277
|
+
switch (_context2.prev = _context2.next) {
|
|
278
|
+
case 0:
|
|
279
|
+
position = _ref.position;
|
|
280
|
+
model._selectionInProgress = true;
|
|
281
|
+
_context2.next = 4;
|
|
282
|
+
return publicAPI.getSelectedDataForXY(position.x, position.y);
|
|
283
|
+
|
|
284
|
+
case 4:
|
|
285
|
+
_yield$publicAPI$getS = _context2.sent;
|
|
286
|
+
requestCount = _yield$publicAPI$getS.requestCount;
|
|
287
|
+
selectedState = _yield$publicAPI$getS.selectedState;
|
|
288
|
+
representation = _yield$publicAPI$getS.representation;
|
|
289
|
+
widget = _yield$publicAPI$getS.widget;
|
|
290
|
+
model._selectionInProgress = false;
|
|
291
|
+
|
|
292
|
+
if (!requestCount) {
|
|
293
|
+
_context2.next = 12;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return _context2.abrupt("return");
|
|
298
|
+
|
|
299
|
+
case 12:
|
|
300
|
+
// Default cursor behavior
|
|
301
|
+
model._apiSpecificRenderWindow.setCursor(widget ? 'pointer' : 'default');
|
|
302
|
+
|
|
303
|
+
if (model.widgetInFocus === widget && widget.hasFocus()) {
|
|
304
|
+
widget.activateHandle({
|
|
305
|
+
selectedState: selectedState,
|
|
306
|
+
representation: representation
|
|
307
|
+
}); // Ken FIXME
|
|
308
|
+
|
|
309
|
+
model._interactor.render();
|
|
310
|
+
|
|
311
|
+
model._interactor.render();
|
|
312
|
+
} else {
|
|
313
|
+
for (i = 0; i < model.widgets.length; i++) {
|
|
314
|
+
w = model.widgets[i];
|
|
315
|
+
|
|
316
|
+
if (w === widget && w.getNestedPickable()) {
|
|
317
|
+
w.activateHandle({
|
|
318
|
+
selectedState: selectedState,
|
|
319
|
+
representation: representation
|
|
320
|
+
});
|
|
321
|
+
model.activeWidget = w;
|
|
322
|
+
} else {
|
|
323
|
+
w.deactivateAllHandles();
|
|
324
|
+
}
|
|
325
|
+
} // Ken FIXME
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
model._interactor.render();
|
|
329
|
+
|
|
330
|
+
model._interactor.render();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
case 14:
|
|
334
|
+
case "end":
|
|
335
|
+
return _context2.stop();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}, _callee2);
|
|
339
|
+
}));
|
|
340
|
+
return _updateSelection.apply(this, arguments);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
var handleEvent = function handleEvent(eventName) {
|
|
344
|
+
var guard = false;
|
|
345
|
+
return function (callData) {
|
|
346
|
+
if (guard || model.isAnimating || !model.pickingEnabled || model._selectionInProgress) {
|
|
347
|
+
return macro.VOID;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
var updatePromise = updateSelection(callData);
|
|
351
|
+
macro.measurePromiseExecution(updatePromise, function (elapsed) {
|
|
352
|
+
// 100ms is deemed fast enough. Anything higher can degrade usability.
|
|
353
|
+
if (elapsed > 100) {
|
|
354
|
+
macro.vtkWarningMacro("vtkWidgetManager updateSelection() took ".concat(elapsed, "ms on ").concat(eventName));
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
updatePromise.then(function () {
|
|
358
|
+
if (model._interactor) {
|
|
359
|
+
// re-trigger the event, ignoring our own handler
|
|
360
|
+
guard = true;
|
|
361
|
+
|
|
362
|
+
model._interactor["invoke".concat(eventName)](callData);
|
|
363
|
+
|
|
364
|
+
guard = false;
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
return macro.EVENT_ABORT;
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
|
|
266
371
|
function updateWidgetForRender(w) {
|
|
267
372
|
w.updateRepresentationForRender(model.renderingType);
|
|
268
373
|
}
|
|
@@ -277,7 +382,7 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
277
382
|
model.widgets.forEach(updateWidgetForRender);
|
|
278
383
|
}
|
|
279
384
|
|
|
280
|
-
function captureBuffers(
|
|
385
|
+
function captureBuffers(_x2, _x3, _x4, _x5) {
|
|
281
386
|
return _captureBuffers.apply(this, arguments);
|
|
282
387
|
}
|
|
283
388
|
|
|
@@ -366,89 +471,9 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
366
471
|
model.isAnimating = false;
|
|
367
472
|
publicAPI.renderWidgets();
|
|
368
473
|
}));
|
|
369
|
-
subscriptions.push(model._interactor.onMouseMove(
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
374
|
-
while (1) {
|
|
375
|
-
switch (_context.prev = _context.next) {
|
|
376
|
-
case 0:
|
|
377
|
-
position = _ref.position;
|
|
378
|
-
|
|
379
|
-
if (!(model.isAnimating || !model.pickingEnabled || model._selectionInProgress)) {
|
|
380
|
-
_context.next = 3;
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
return _context.abrupt("return");
|
|
385
|
-
|
|
386
|
-
case 3:
|
|
387
|
-
model._selectionInProgress = true;
|
|
388
|
-
_context.next = 6;
|
|
389
|
-
return publicAPI.getSelectedDataForXY(position.x, position.y);
|
|
390
|
-
|
|
391
|
-
case 6:
|
|
392
|
-
_yield$publicAPI$getS = _context.sent;
|
|
393
|
-
requestCount = _yield$publicAPI$getS.requestCount;
|
|
394
|
-
selectedState = _yield$publicAPI$getS.selectedState;
|
|
395
|
-
representation = _yield$publicAPI$getS.representation;
|
|
396
|
-
widget = _yield$publicAPI$getS.widget;
|
|
397
|
-
model._selectionInProgress = false;
|
|
398
|
-
|
|
399
|
-
if (!requestCount) {
|
|
400
|
-
_context.next = 14;
|
|
401
|
-
break;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return _context.abrupt("return");
|
|
405
|
-
|
|
406
|
-
case 14:
|
|
407
|
-
// Default cursor behavior
|
|
408
|
-
model._apiSpecificRenderWindow.setCursor(widget ? 'pointer' : 'default');
|
|
409
|
-
|
|
410
|
-
if (model.widgetInFocus === widget && widget.hasFocus()) {
|
|
411
|
-
widget.activateHandle({
|
|
412
|
-
selectedState: selectedState,
|
|
413
|
-
representation: representation
|
|
414
|
-
}); // Ken FIXME
|
|
415
|
-
|
|
416
|
-
model._interactor.render();
|
|
417
|
-
|
|
418
|
-
model._interactor.render();
|
|
419
|
-
} else {
|
|
420
|
-
for (i = 0; i < model.widgets.length; i++) {
|
|
421
|
-
w = model.widgets[i];
|
|
422
|
-
|
|
423
|
-
if (w === widget && w.getNestedPickable()) {
|
|
424
|
-
w.activateHandle({
|
|
425
|
-
selectedState: selectedState,
|
|
426
|
-
representation: representation
|
|
427
|
-
});
|
|
428
|
-
model.activeWidget = w;
|
|
429
|
-
} else {
|
|
430
|
-
w.deactivateAllHandles();
|
|
431
|
-
}
|
|
432
|
-
} // Ken FIXME
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
model._interactor.render();
|
|
436
|
-
|
|
437
|
-
model._interactor.render();
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
case 16:
|
|
441
|
-
case "end":
|
|
442
|
-
return _context.stop();
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}, _callee);
|
|
446
|
-
}));
|
|
447
|
-
|
|
448
|
-
return function (_x5) {
|
|
449
|
-
return _ref2.apply(this, arguments);
|
|
450
|
-
};
|
|
451
|
-
}()));
|
|
474
|
+
subscriptions.push(model._interactor.onMouseMove(handleEvent('MouseMove')));
|
|
475
|
+
subscriptions.push(model._interactor.onLeftButtonPress(handleEvent('LeftButtonPress'), // stay after widgets, but before default of 0
|
|
476
|
+
WIDGET_PRIORITY / 2));
|
|
452
477
|
publicAPI.modified();
|
|
453
478
|
|
|
454
479
|
if (model.pickingEnabled) {
|
|
@@ -530,16 +555,16 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
530
555
|
};
|
|
531
556
|
|
|
532
557
|
publicAPI.getSelectedDataForXY = /*#__PURE__*/function () {
|
|
533
|
-
var
|
|
558
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(x, y) {
|
|
534
559
|
var i, widget, hoveredSVGReps, selection, capturedRegion;
|
|
535
|
-
return _regeneratorRuntime.wrap(function
|
|
560
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
536
561
|
while (1) {
|
|
537
|
-
switch (
|
|
562
|
+
switch (_context.prev = _context.next) {
|
|
538
563
|
case 0:
|
|
539
564
|
model.selections = null;
|
|
540
565
|
|
|
541
566
|
if (!model.pickingEnabled) {
|
|
542
|
-
|
|
567
|
+
_context.next = 24;
|
|
543
568
|
break;
|
|
544
569
|
}
|
|
545
570
|
|
|
@@ -547,7 +572,7 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
547
572
|
|
|
548
573
|
case 3:
|
|
549
574
|
if (!(i < model.widgets.length)) {
|
|
550
|
-
|
|
575
|
+
_context.next = 16;
|
|
551
576
|
break;
|
|
552
577
|
}
|
|
553
578
|
|
|
@@ -557,7 +582,7 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
557
582
|
});
|
|
558
583
|
|
|
559
584
|
if (!hoveredSVGReps.length) {
|
|
560
|
-
|
|
585
|
+
_context.next = 13;
|
|
561
586
|
break;
|
|
562
587
|
}
|
|
563
588
|
|
|
@@ -566,20 +591,20 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
566
591
|
selection.getProperties().widget = widget;
|
|
567
592
|
selection.getProperties().representation = hoveredSVGReps[0];
|
|
568
593
|
model.selections = [selection];
|
|
569
|
-
return
|
|
594
|
+
return _context.abrupt("return", publicAPI.getSelectedData());
|
|
570
595
|
|
|
571
596
|
case 13:
|
|
572
597
|
++i;
|
|
573
|
-
|
|
598
|
+
_context.next = 3;
|
|
574
599
|
break;
|
|
575
600
|
|
|
576
601
|
case 16:
|
|
577
602
|
if (!(!model._capturedBuffers || model.captureOn === CaptureOn.MOUSE_MOVE)) {
|
|
578
|
-
|
|
603
|
+
_context.next = 19;
|
|
579
604
|
break;
|
|
580
605
|
}
|
|
581
606
|
|
|
582
|
-
|
|
607
|
+
_context.next = 19;
|
|
583
608
|
return captureBuffers(x, y, x, y);
|
|
584
609
|
|
|
585
610
|
case 19:
|
|
@@ -587,29 +612,29 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
587
612
|
capturedRegion = model._capturedBuffers.area;
|
|
588
613
|
|
|
589
614
|
if (!(x < capturedRegion[0] || x > capturedRegion[2] || y < capturedRegion[1] || y > capturedRegion[3])) {
|
|
590
|
-
|
|
615
|
+
_context.next = 23;
|
|
591
616
|
break;
|
|
592
617
|
}
|
|
593
618
|
|
|
594
|
-
|
|
619
|
+
_context.next = 23;
|
|
595
620
|
return captureBuffers(x, y, x, y);
|
|
596
621
|
|
|
597
622
|
case 23:
|
|
598
623
|
model.selections = model._capturedBuffers.generateSelection(x, y, x, y);
|
|
599
624
|
|
|
600
625
|
case 24:
|
|
601
|
-
return
|
|
626
|
+
return _context.abrupt("return", publicAPI.getSelectedData());
|
|
602
627
|
|
|
603
628
|
case 25:
|
|
604
629
|
case "end":
|
|
605
|
-
return
|
|
630
|
+
return _context.stop();
|
|
606
631
|
}
|
|
607
632
|
}
|
|
608
|
-
},
|
|
633
|
+
}, _callee);
|
|
609
634
|
}));
|
|
610
635
|
|
|
611
636
|
return function (_x6, _x7) {
|
|
612
|
-
return
|
|
637
|
+
return _ref2.apply(this, arguments);
|
|
613
638
|
};
|
|
614
639
|
}();
|
|
615
640
|
|
|
@@ -16,6 +16,20 @@ function widgetBehavior(publicAPI, model) {
|
|
|
16
16
|
|
|
17
17
|
function ignoreKey(e) {
|
|
18
18
|
return e.altKey || e.controlKey || e.shiftKey;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function updateMoveHandle(callData) {
|
|
22
|
+
model.manipulator.setOrigin(model._camera.getFocalPoint());
|
|
23
|
+
model.manipulator.setNormal(model._camera.getDirectionOfProjection());
|
|
24
|
+
var worldCoords = model.manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
25
|
+
|
|
26
|
+
if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || isDragging)) {
|
|
27
|
+
model.activeState.setOrigin(worldCoords);
|
|
28
|
+
publicAPI.invokeInteractionEvent();
|
|
29
|
+
return macro.EVENT_ABORT;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return macro.VOID;
|
|
19
33
|
} // --------------------------------------------------------------------------
|
|
20
34
|
// Right click: Delete handle
|
|
21
35
|
// --------------------------------------------------------------------------
|
|
@@ -51,7 +65,8 @@ function widgetBehavior(publicAPI, model) {
|
|
|
51
65
|
}
|
|
52
66
|
|
|
53
67
|
if (model.activeState === model.widgetState.getMoveHandle()) {
|
|
54
|
-
// Commit handle to location
|
|
68
|
+
updateMoveHandle(e); // Commit handle to location
|
|
69
|
+
|
|
55
70
|
var moveHandle = model.widgetState.getMoveHandle();
|
|
56
71
|
var newHandle = model.widgetState.addHandle();
|
|
57
72
|
newHandle.setOrigin.apply(newHandle, _toConsumableArray(moveHandle.getOrigin()));
|
|
@@ -74,13 +89,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
74
89
|
|
|
75
90
|
publicAPI.handleMouseMove = function (callData) {
|
|
76
91
|
if (model.pickable && model.dragable && model.manipulator && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
|
|
77
|
-
|
|
78
|
-
model.manipulator.setNormal(model._camera.getDirectionOfProjection());
|
|
79
|
-
var worldCoords = model.manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
80
|
-
|
|
81
|
-
if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || isDragging)) {
|
|
82
|
-
model.activeState.setOrigin(worldCoords);
|
|
83
|
-
publicAPI.invokeInteractionEvent();
|
|
92
|
+
if (updateMoveHandle(callData) === macro.EVENT_ABORT) {
|
|
84
93
|
return macro.EVENT_ABORT;
|
|
85
94
|
}
|
|
86
95
|
}
|
package/index.d.ts
CHANGED
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
/// <reference path="./Rendering/Core/Actor.d.ts" />
|
|
96
96
|
/// <reference path="./Rendering/Core/Actor2D.d.ts" />
|
|
97
97
|
/// <reference path="./Rendering/Core/AnnotatedCubeActor.d.ts" />
|
|
98
|
-
/// <reference path="./Rendering/Core/AxesActor.d.ts" />
|
|
99
98
|
/// <reference path="./Rendering/Core/Camera.d.ts" />
|
|
99
|
+
/// <reference path="./Rendering/Core/AxesActor.d.ts" />
|
|
100
100
|
/// <reference path="./Rendering/Core/CellPicker.d.ts" />
|
|
101
101
|
/// <reference path="./Rendering/Core/ColorTransferFunction.d.ts" />
|
|
102
102
|
/// <reference path="./Rendering/Core/Coordinate.d.ts" />
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
/// <reference path="./Rendering/Core/Property.d.ts" />
|
|
117
117
|
/// <reference path="./Rendering/Core/Property2D.d.ts" />
|
|
118
118
|
/// <reference path="./Rendering/Core/Renderer.d.ts" />
|
|
119
|
-
/// <reference path="./Rendering/Core/RenderWindow.d.ts" />
|
|
120
119
|
/// <reference path="./Rendering/Core/RenderWindowInteractor.d.ts" />
|
|
120
|
+
/// <reference path="./Rendering/Core/RenderWindow.d.ts" />
|
|
121
121
|
/// <reference path="./Rendering/Core/ScalarBarActor.d.ts" />
|
|
122
122
|
/// <reference path="./Rendering/Core/Skybox.d.ts" />
|
|
123
123
|
/// <reference path="./Rendering/Core/SphereMapper.d.ts" />
|
package/macros.d.ts
CHANGED
|
@@ -138,6 +138,16 @@ declare function getStateArrayMapFunc(item: any): any;
|
|
|
138
138
|
*/
|
|
139
139
|
export function setImmediateVTK(fn: () => void ): void;
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Measures the time it takes for a promise to finish from the time this function is invoked.
|
|
143
|
+
*
|
|
144
|
+
* The callback receives the time it took for the promise to resolve or reject.
|
|
145
|
+
*
|
|
146
|
+
* @param promise promise to measure
|
|
147
|
+
* @param callback called with the elapsed time for the promise
|
|
148
|
+
*/
|
|
149
|
+
export function measurePromiseExecution(promise: Promise<any>, callback: (elapsed: number) => void): void;
|
|
150
|
+
|
|
141
151
|
/**
|
|
142
152
|
* Turns the provided publicAPI into a VtkObject
|
|
143
153
|
*
|
|
@@ -631,6 +641,8 @@ declare const Macro: {
|
|
|
631
641
|
getStateArrayMapFunc: typeof getStateArrayMapFunc,
|
|
632
642
|
isVtkObject: typeof isVtkObject,
|
|
633
643
|
keystore: typeof keystore,
|
|
644
|
+
measurePromiseExecution: typeof measurePromiseExecution,
|
|
645
|
+
moveToProtected: typeof moveToProtected,
|
|
634
646
|
newInstance: typeof newInstance,
|
|
635
647
|
normalizeWheel: typeof normalizeWheel,
|
|
636
648
|
obj: typeof obj,
|
package/macros.js
CHANGED
|
@@ -202,6 +202,20 @@ function getStateArrayMapFunc(item) {
|
|
|
202
202
|
function setImmediateVTK(fn) {
|
|
203
203
|
setTimeout(fn, 0);
|
|
204
204
|
} // ----------------------------------------------------------------------------
|
|
205
|
+
// measurePromiseExecution
|
|
206
|
+
//
|
|
207
|
+
// Measures the time it takes for a promise to finish from
|
|
208
|
+
// the time this function is invoked.
|
|
209
|
+
// The callback receives the time it took for the promise to resolve or reject.
|
|
210
|
+
// ----------------------------------------------------------------------------
|
|
211
|
+
|
|
212
|
+
function measurePromiseExecution(promise, callback) {
|
|
213
|
+
var start = performance.now();
|
|
214
|
+
promise.finally(function () {
|
|
215
|
+
var delta = performance.now() - start;
|
|
216
|
+
callback(delta);
|
|
217
|
+
});
|
|
218
|
+
} // ----------------------------------------------------------------------------
|
|
205
219
|
// vtkObject: modified(), onModified(callback), delete()
|
|
206
220
|
// ----------------------------------------------------------------------------
|
|
207
221
|
|
|
@@ -1824,6 +1838,7 @@ var macro = {
|
|
|
1824
1838
|
getStateArrayMapFunc: getStateArrayMapFunc,
|
|
1825
1839
|
isVtkObject: isVtkObject,
|
|
1826
1840
|
keystore: keystore,
|
|
1841
|
+
measurePromiseExecution: measurePromiseExecution,
|
|
1827
1842
|
moveToProtected: moveToProtected,
|
|
1828
1843
|
newInstance: newInstance,
|
|
1829
1844
|
newTypedArray: newTypedArray,
|
|
@@ -1854,4 +1869,4 @@ var macro = {
|
|
|
1854
1869
|
vtkWarningMacro: vtkWarningMacro
|
|
1855
1870
|
};
|
|
1856
1871
|
|
|
1857
|
-
export { EVENT_ABORT, TYPED_ARRAYS, VOID, _capitalize, algo, capitalize, chain, debounce, macro as default, event, formatBytesToProperUnit, formatNumbersWithThousandSeparator, get, getArray, isVtkObject, keystore, moveToProtected, newInstance, newTypedArray, newTypedArrayFrom, normalizeWheel, obj, proxy, proxyPropertyMapping, proxyPropertyState, set, setArray, setGet, setGetArray, setImmediateVTK, setLoggerFunction, throttle, traverseInstanceTree, uncapitalize, vtkDebugMacro, vtkErrorMacro, vtkInfoMacro, vtkLogMacro, vtkOnceErrorMacro, vtkWarningMacro };
|
|
1872
|
+
export { EVENT_ABORT, TYPED_ARRAYS, VOID, _capitalize, algo, capitalize, chain, debounce, macro as default, event, formatBytesToProperUnit, formatNumbersWithThousandSeparator, get, getArray, isVtkObject, keystore, measurePromiseExecution, moveToProtected, newInstance, newTypedArray, newTypedArrayFrom, normalizeWheel, obj, proxy, proxyPropertyMapping, proxyPropertyState, set, setArray, setGet, setGetArray, setImmediateVTK, setLoggerFunction, throttle, traverseInstanceTree, uncapitalize, vtkDebugMacro, vtkErrorMacro, vtkInfoMacro, vtkLogMacro, vtkOnceErrorMacro, vtkWarningMacro };
|