@kitware/vtk.js 25.8.1 → 25.8.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.
|
@@ -38,16 +38,10 @@ function convert(xx, yy, pb, area) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
var offset = (yy * (area[2] - area[0] + 1) + xx) * 4;
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var val = rgb[2];
|
|
46
|
-
val *= 256;
|
|
47
|
-
val += rgb[1];
|
|
48
|
-
val *= 256;
|
|
49
|
-
val += rgb[0];
|
|
50
|
-
return val;
|
|
41
|
+
var r = pb[offset];
|
|
42
|
+
var g = pb[offset + 1];
|
|
43
|
+
var b = pb[offset + 2];
|
|
44
|
+
return (b * 256 + g) * 256 + r;
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
function getID(low24, high8) {
|
|
@@ -520,7 +520,8 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
|
|
|
520
520
|
|
|
521
521
|
if (result !== undefined) {
|
|
522
522
|
publicAPI.getTextureUnitManager().free(result);
|
|
523
|
-
|
|
523
|
+
|
|
524
|
+
model._textureResourceIds.delete(texture);
|
|
524
525
|
}
|
|
525
526
|
};
|
|
526
527
|
|
|
@@ -271,47 +271,59 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
271
271
|
// --------------------------------------------------------------------------
|
|
272
272
|
|
|
273
273
|
|
|
274
|
-
function updateSelection(_x) {
|
|
274
|
+
function updateSelection(_x, _x2, _x3) {
|
|
275
275
|
return _updateSelection.apply(this, arguments);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
function _updateSelection() {
|
|
279
|
-
_updateSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
280
|
-
var position, _yield$publicAPI$getS, requestCount, selectedState, representation, widget, i, w;
|
|
279
|
+
_updateSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(callData, fromTouchEvent, callID) {
|
|
280
|
+
var position, _yield$publicAPI$getS, requestCount, selectedState, representation, widget, activateHandle, i, w;
|
|
281
281
|
|
|
282
|
-
return _regeneratorRuntime.wrap(function
|
|
282
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
283
283
|
while (1) {
|
|
284
|
-
switch (
|
|
284
|
+
switch (_context3.prev = _context3.next) {
|
|
285
285
|
case 0:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
activateHandle = function _activateHandle(w) {
|
|
287
|
+
if (fromTouchEvent) {
|
|
288
|
+
// release any previous left button interaction
|
|
289
|
+
model._interactor.invokeLeftButtonRelease(callData);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
w.activateHandle({
|
|
293
|
+
selectedState: selectedState,
|
|
294
|
+
representation: representation
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
if (fromTouchEvent) {
|
|
298
|
+
// re-trigger the left button press to pick the now-active widget
|
|
299
|
+
model._interactor.invokeLeftButtonPress(callData);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
position = callData.position;
|
|
304
|
+
_context3.next = 4;
|
|
289
305
|
return publicAPI.getSelectedDataForXY(position.x, position.y);
|
|
290
306
|
|
|
291
307
|
case 4:
|
|
292
|
-
_yield$publicAPI$getS =
|
|
308
|
+
_yield$publicAPI$getS = _context3.sent;
|
|
293
309
|
requestCount = _yield$publicAPI$getS.requestCount;
|
|
294
310
|
selectedState = _yield$publicAPI$getS.selectedState;
|
|
295
311
|
representation = _yield$publicAPI$getS.representation;
|
|
296
312
|
widget = _yield$publicAPI$getS.widget;
|
|
297
|
-
model._selectionInProgress = false;
|
|
298
313
|
|
|
299
|
-
if (!requestCount) {
|
|
300
|
-
|
|
314
|
+
if (!(requestCount || callID !== model._currentUpdateSelectionCallID)) {
|
|
315
|
+
_context3.next = 11;
|
|
301
316
|
break;
|
|
302
317
|
}
|
|
303
318
|
|
|
304
|
-
return
|
|
319
|
+
return _context3.abrupt("return");
|
|
305
320
|
|
|
306
|
-
case
|
|
321
|
+
case 11:
|
|
307
322
|
// Default cursor behavior
|
|
308
323
|
model._apiSpecificRenderWindow.setCursor(widget ? 'pointer' : 'default');
|
|
309
324
|
|
|
310
325
|
if (model.widgetInFocus === widget && widget.hasFocus()) {
|
|
311
|
-
|
|
312
|
-
selectedState: selectedState,
|
|
313
|
-
representation: representation
|
|
314
|
-
}); // Ken FIXME
|
|
326
|
+
activateHandle(widget); // Ken FIXME
|
|
315
327
|
|
|
316
328
|
model._interactor.render();
|
|
317
329
|
|
|
@@ -321,10 +333,7 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
321
333
|
w = model.widgets[i];
|
|
322
334
|
|
|
323
335
|
if (w === widget && w.getNestedPickable()) {
|
|
324
|
-
|
|
325
|
-
selectedState: selectedState,
|
|
326
|
-
representation: representation
|
|
327
|
-
});
|
|
336
|
+
activateHandle(w);
|
|
328
337
|
model.activeWidget = w;
|
|
329
338
|
} else {
|
|
330
339
|
w.deactivateAllHandles();
|
|
@@ -337,43 +346,49 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
337
346
|
model._interactor.render();
|
|
338
347
|
}
|
|
339
348
|
|
|
340
|
-
case
|
|
349
|
+
case 13:
|
|
341
350
|
case "end":
|
|
342
|
-
return
|
|
351
|
+
return _context3.stop();
|
|
343
352
|
}
|
|
344
353
|
}
|
|
345
|
-
},
|
|
354
|
+
}, _callee3);
|
|
346
355
|
}));
|
|
347
356
|
return _updateSelection.apply(this, arguments);
|
|
348
357
|
}
|
|
349
358
|
|
|
350
|
-
var handleEvent = function
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
359
|
+
var handleEvent = /*#__PURE__*/function () {
|
|
360
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(callData) {
|
|
361
|
+
var fromTouchEvent,
|
|
362
|
+
callID,
|
|
363
|
+
_args = arguments;
|
|
364
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
365
|
+
while (1) {
|
|
366
|
+
switch (_context.prev = _context.next) {
|
|
367
|
+
case 0:
|
|
368
|
+
fromTouchEvent = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
|
|
356
369
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
macro.vtkWarningMacro("vtkWidgetManager updateSelection() took ".concat(elapsed, "ms on ").concat(eventName));
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
updatePromise.then(function () {
|
|
365
|
-
if (model._interactor) {
|
|
366
|
-
// re-trigger the event, ignoring our own handler
|
|
367
|
-
guard = true;
|
|
370
|
+
if (!(!model.isAnimating && model.pickingEnabled)) {
|
|
371
|
+
_context.next = 6;
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
368
374
|
|
|
369
|
-
|
|
375
|
+
callID = Symbol('UpdateSelection');
|
|
376
|
+
model._currentUpdateSelectionCallID = callID;
|
|
377
|
+
_context.next = 6;
|
|
378
|
+
return updateSelection(callData, fromTouchEvent, callID);
|
|
370
379
|
|
|
371
|
-
|
|
380
|
+
case 6:
|
|
381
|
+
case "end":
|
|
382
|
+
return _context.stop();
|
|
383
|
+
}
|
|
372
384
|
}
|
|
373
|
-
});
|
|
374
|
-
|
|
385
|
+
}, _callee);
|
|
386
|
+
}));
|
|
387
|
+
|
|
388
|
+
return function handleEvent(_x4) {
|
|
389
|
+
return _ref.apply(this, arguments);
|
|
375
390
|
};
|
|
376
|
-
};
|
|
391
|
+
}();
|
|
377
392
|
|
|
378
393
|
function updateWidgetForRender(w) {
|
|
379
394
|
w.updateRepresentationForRender(model.renderingType);
|
|
@@ -389,42 +404,42 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
389
404
|
model.widgets.forEach(updateWidgetForRender);
|
|
390
405
|
}
|
|
391
406
|
|
|
392
|
-
function captureBuffers(
|
|
407
|
+
function captureBuffers(_x5, _x6, _x7, _x8) {
|
|
393
408
|
return _captureBuffers.apply(this, arguments);
|
|
394
409
|
}
|
|
395
410
|
|
|
396
411
|
function _captureBuffers() {
|
|
397
|
-
_captureBuffers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
398
|
-
return _regeneratorRuntime.wrap(function
|
|
412
|
+
_captureBuffers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(x1, y1, x2, y2) {
|
|
413
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
399
414
|
while (1) {
|
|
400
|
-
switch (
|
|
415
|
+
switch (_context4.prev = _context4.next) {
|
|
401
416
|
case 0:
|
|
402
417
|
if (!model._captureInProgress) {
|
|
403
|
-
|
|
418
|
+
_context4.next = 2;
|
|
404
419
|
break;
|
|
405
420
|
}
|
|
406
421
|
|
|
407
|
-
return
|
|
422
|
+
return _context4.abrupt("return");
|
|
408
423
|
|
|
409
424
|
case 2:
|
|
410
425
|
model._captureInProgress = true;
|
|
411
426
|
renderPickingBuffer();
|
|
412
427
|
model._capturedBuffers = null;
|
|
413
|
-
|
|
428
|
+
_context4.next = 7;
|
|
414
429
|
return model._selector.getSourceDataAsync(model._renderer, x1, y1, x2, y2);
|
|
415
430
|
|
|
416
431
|
case 7:
|
|
417
|
-
model._capturedBuffers =
|
|
432
|
+
model._capturedBuffers = _context4.sent;
|
|
418
433
|
model.previousSelectedData = null;
|
|
419
434
|
renderFrontBuffer();
|
|
420
435
|
model._captureInProgress = false;
|
|
421
436
|
|
|
422
437
|
case 11:
|
|
423
438
|
case "end":
|
|
424
|
-
return
|
|
439
|
+
return _context4.stop();
|
|
425
440
|
}
|
|
426
441
|
}
|
|
427
|
-
},
|
|
442
|
+
}, _callee4);
|
|
428
443
|
}));
|
|
429
444
|
return _captureBuffers.apply(this, arguments);
|
|
430
445
|
}
|
|
@@ -480,9 +495,21 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
480
495
|
model.isAnimating = false;
|
|
481
496
|
publicAPI.renderWidgets();
|
|
482
497
|
}));
|
|
483
|
-
subscriptions.push(model._interactor.onMouseMove(
|
|
484
|
-
|
|
485
|
-
|
|
498
|
+
subscriptions.push(model._interactor.onMouseMove(function (eventData) {
|
|
499
|
+
handleEvent(eventData);
|
|
500
|
+
return macro.VOID;
|
|
501
|
+
})); // must be handled after widgets, hence the given priority.
|
|
502
|
+
|
|
503
|
+
subscriptions.push(model._interactor.onLeftButtonPress(function (eventData) {
|
|
504
|
+
var deviceType = eventData.deviceType;
|
|
505
|
+
var touchEvent = deviceType === 'touch' || deviceType === 'pen'; // only try selection if the left button press is from touch.
|
|
506
|
+
|
|
507
|
+
if (touchEvent) {
|
|
508
|
+
handleEvent(eventData, touchEvent);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return macro.VOID;
|
|
512
|
+
}, WIDGET_PRIORITY / 2));
|
|
486
513
|
publicAPI.modified();
|
|
487
514
|
|
|
488
515
|
if (model.pickingEnabled) {
|
|
@@ -564,16 +591,16 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
564
591
|
};
|
|
565
592
|
|
|
566
593
|
publicAPI.getSelectedDataForXY = /*#__PURE__*/function () {
|
|
567
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
594
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(x, y) {
|
|
568
595
|
var i, widget, hoveredSVGReps, selection, capturedRegion;
|
|
569
|
-
return _regeneratorRuntime.wrap(function
|
|
596
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
570
597
|
while (1) {
|
|
571
|
-
switch (
|
|
598
|
+
switch (_context2.prev = _context2.next) {
|
|
572
599
|
case 0:
|
|
573
600
|
model.selections = null;
|
|
574
601
|
|
|
575
602
|
if (!model.pickingEnabled) {
|
|
576
|
-
|
|
603
|
+
_context2.next = 24;
|
|
577
604
|
break;
|
|
578
605
|
}
|
|
579
606
|
|
|
@@ -581,7 +608,7 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
581
608
|
|
|
582
609
|
case 3:
|
|
583
610
|
if (!(i < model.widgets.length)) {
|
|
584
|
-
|
|
611
|
+
_context2.next = 16;
|
|
585
612
|
break;
|
|
586
613
|
}
|
|
587
614
|
|
|
@@ -591,7 +618,7 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
591
618
|
});
|
|
592
619
|
|
|
593
620
|
if (!hoveredSVGReps.length) {
|
|
594
|
-
|
|
621
|
+
_context2.next = 13;
|
|
595
622
|
break;
|
|
596
623
|
}
|
|
597
624
|
|
|
@@ -600,20 +627,20 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
600
627
|
selection.getProperties().widget = widget;
|
|
601
628
|
selection.getProperties().representation = hoveredSVGReps[0];
|
|
602
629
|
model.selections = [selection];
|
|
603
|
-
return
|
|
630
|
+
return _context2.abrupt("return", publicAPI.getSelectedData());
|
|
604
631
|
|
|
605
632
|
case 13:
|
|
606
633
|
++i;
|
|
607
|
-
|
|
634
|
+
_context2.next = 3;
|
|
608
635
|
break;
|
|
609
636
|
|
|
610
637
|
case 16:
|
|
611
638
|
if (!(!model._capturedBuffers || model.captureOn === CaptureOn.MOUSE_MOVE)) {
|
|
612
|
-
|
|
639
|
+
_context2.next = 19;
|
|
613
640
|
break;
|
|
614
641
|
}
|
|
615
642
|
|
|
616
|
-
|
|
643
|
+
_context2.next = 19;
|
|
617
644
|
return captureBuffers(x, y, x, y);
|
|
618
645
|
|
|
619
646
|
case 19:
|
|
@@ -621,28 +648,28 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
621
648
|
capturedRegion = model._capturedBuffers.area;
|
|
622
649
|
|
|
623
650
|
if (!(x < capturedRegion[0] || x > capturedRegion[2] || y < capturedRegion[1] || y > capturedRegion[3])) {
|
|
624
|
-
|
|
651
|
+
_context2.next = 23;
|
|
625
652
|
break;
|
|
626
653
|
}
|
|
627
654
|
|
|
628
|
-
|
|
655
|
+
_context2.next = 23;
|
|
629
656
|
return captureBuffers(x, y, x, y);
|
|
630
657
|
|
|
631
658
|
case 23:
|
|
632
659
|
model.selections = model._capturedBuffers.generateSelection(x, y, x, y);
|
|
633
660
|
|
|
634
661
|
case 24:
|
|
635
|
-
return
|
|
662
|
+
return _context2.abrupt("return", publicAPI.getSelectedData());
|
|
636
663
|
|
|
637
664
|
case 25:
|
|
638
665
|
case "end":
|
|
639
|
-
return
|
|
666
|
+
return _context2.stop();
|
|
640
667
|
}
|
|
641
668
|
}
|
|
642
|
-
},
|
|
669
|
+
}, _callee2);
|
|
643
670
|
}));
|
|
644
671
|
|
|
645
|
-
return function (
|
|
672
|
+
return function (_x9, _x10) {
|
|
646
673
|
return _ref2.apply(this, arguments);
|
|
647
674
|
};
|
|
648
675
|
}();
|
|
@@ -791,6 +818,7 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
791
818
|
var DEFAULT_VALUES = {
|
|
792
819
|
// _camera: null,
|
|
793
820
|
// _selector: null,
|
|
821
|
+
// _currentUpdateSelectionCallID: null,
|
|
794
822
|
viewId: null,
|
|
795
823
|
widgets: [],
|
|
796
824
|
renderer: null,
|