@kitware/vtk.js 25.10.0 → 26.0.0-beta.2

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.
Files changed (197) hide show
  1. package/Common/Core/CellArray.d.ts +0 -6
  2. package/Common/Core/CellArray.js +21 -12
  3. package/Common/Core/ClassHierarchy.js +11 -6
  4. package/Common/Core/DataArray.d.ts +20 -0
  5. package/Common/Core/DataArray.js +21 -4
  6. package/Proxy/Core/ViewProxy.js +17 -9
  7. package/Rendering/Core/ColorTransferFunction.d.ts +0 -20
  8. package/Rendering/Core/ColorTransferFunction.js +0 -63
  9. package/Rendering/Core/Prop3D.js +1 -6
  10. package/Rendering/Core/RenderWindow.js +9 -6
  11. package/Rendering/Core/VolumeProperty.js +2 -3
  12. package/Rendering/Misc/CanvasView.js +6 -5
  13. package/Rendering/Misc/GenericRenderWindow.js +12 -7
  14. package/Rendering/OpenGL/Actor.js +4 -4
  15. package/Rendering/OpenGL/Actor2D.js +4 -4
  16. package/Rendering/OpenGL/Camera.js +7 -4
  17. package/Rendering/OpenGL/CubeAxesActor.js +7 -5
  18. package/Rendering/OpenGL/ForwardPass.js +1 -1
  19. package/Rendering/OpenGL/Glyph3DMapper.js +4 -4
  20. package/Rendering/OpenGL/ImageMapper.js +9 -5
  21. package/Rendering/OpenGL/ImageSlice.js +3 -3
  22. package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +9 -5
  23. package/Rendering/OpenGL/PolyDataMapper.js +27 -21
  24. package/Rendering/OpenGL/PolyDataMapper2D.js +17 -10
  25. package/Rendering/OpenGL/ScalarBarActor.js +6 -4
  26. package/Rendering/OpenGL/Skybox.js +10 -6
  27. package/Rendering/OpenGL/Texture.js +6 -5
  28. package/Rendering/OpenGL/Volume.js +2 -2
  29. package/Rendering/OpenGL/VolumeMapper.js +11 -11
  30. package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
  31. package/Rendering/SceneGraph/RenderPass.js +3 -2
  32. package/Rendering/WebGPU/ForwardPass.js +1 -1
  33. package/Rendering/WebGPU/HardwareSelectionPass.js +1 -1
  34. package/Rendering/WebGPU/HardwareSelector.js +14 -13
  35. package/Rendering/WebGPU/OpaquePass.js +1 -1
  36. package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +1 -1
  37. package/Rendering/WebGPU/VolumePass.js +1 -1
  38. package/Utilities/config/rules-tests.js +28 -0
  39. package/Widgets/Core/AbstractWidgetFactory.js +1 -0
  40. package/Widgets/Core/StateBuilder/color3Mixin.js +22 -0
  41. package/Widgets/Core/StateBuilder/colorMixin.js +7 -0
  42. package/Widgets/Core/StateBuilder.js +2 -0
  43. package/Widgets/Core/WidgetManager.js +21 -256
  44. package/Widgets/Representations/ArrowHandleRepresentation.js +28 -110
  45. package/Widgets/Representations/CircleContextRepresentation.js +43 -165
  46. package/Widgets/Representations/ContextRepresentation.js +0 -3
  47. package/Widgets/Representations/ConvexFaceContextRepresentation.js +11 -11
  48. package/Widgets/Representations/CroppingOutlineRepresentation.js +5 -12
  49. package/Widgets/Representations/CubeHandleRepresentation.js +15 -104
  50. package/Widgets/Representations/GlyphRepresentation.js +320 -0
  51. package/Widgets/Representations/HandleRepresentation.js +0 -5
  52. package/Widgets/Representations/ImplicitPlaneRepresentation.js +68 -49
  53. package/Widgets/Representations/LineHandleRepresentation.js +116 -0
  54. package/Widgets/Representations/PolyLineRepresentation.js +52 -49
  55. package/Widgets/Representations/RectangleContextRepresentation.js +16 -21
  56. package/Widgets/Representations/SphereContextRepresentation.js +30 -109
  57. package/Widgets/Representations/SphereHandleRepresentation.js +13 -110
  58. package/Widgets/Representations/SplineContextRepresentation.js +53 -36
  59. package/Widgets/Representations/WidgetRepresentation.d.ts +52 -1
  60. package/Widgets/Representations/WidgetRepresentation.js +140 -78
  61. package/Widgets/Representations.js +6 -0
  62. package/Widgets/Widgets3D/AngleWidget.js +1 -4
  63. package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
  64. package/Widgets/Widgets3D/EllipseWidget.js +0 -7
  65. package/Widgets/Widgets3D/LabelWidget/behavior.js +0 -7
  66. package/Widgets/Widgets3D/LabelWidget.js +1 -18
  67. package/Widgets/Widgets3D/LineWidget/behavior.js +0 -44
  68. package/Widgets/Widgets3D/LineWidget.js +0 -11
  69. package/Widgets/Widgets3D/PolyLineWidget.js +0 -10
  70. package/Widgets/Widgets3D/RectangleWidget.js +0 -7
  71. package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +15 -3
  72. package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +93 -36
  73. package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +75 -82
  74. package/Widgets/Widgets3D/ResliceCursorWidget/state.js +49 -170
  75. package/Widgets/Widgets3D/ResliceCursorWidget.js +61 -23
  76. package/Widgets/Widgets3D/ShapeWidget.js +1 -1
  77. package/index.d.ts +0 -1
  78. package/macros.d.ts +3 -5
  79. package/macros.js +4 -35
  80. package/package.json +3 -2
  81. package/Widgets/Core/WidgetManager/vdom.js +0 -172
  82. package/Widgets/Representations/ResliceCursorContextRepresentation/Constants.js +0 -12
  83. package/Widgets/Representations/ResliceCursorContextRepresentation.d.ts +0 -54
  84. package/Widgets/Representations/ResliceCursorContextRepresentation.js +0 -357
  85. package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +0 -28
  86. package/Widgets/SVG/SVGLandmarkRepresentation.js +0 -179
  87. package/Widgets/SVG/SVGRepresentation.js +0 -163
  88. package/_vendor/available-typed-arrays/index.js_commonjs-proxy.js +0 -1
  89. package/_vendor/call-bind/callBound.js_commonjs-proxy.js +0 -1
  90. package/_vendor/call-bind/index.js_commonjs-module.js +0 -3
  91. package/_vendor/call-bind/index.js_commonjs-proxy.js +0 -1
  92. package/_vendor/deep-equal/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
  93. package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
  94. package/_vendor/es-abstract/helpers/getOwnPropertyDescriptor.js_commonjs-proxy.js +0 -1
  95. package/_vendor/es-get-iterator/index.js_commonjs-module.js +0 -3
  96. package/_vendor/es-get-iterator/index.js_commonjs-proxy.js +0 -1
  97. package/_vendor/es-get-iterator/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
  98. package/_vendor/foreach/index.js_commonjs-proxy.js +0 -1
  99. package/_vendor/function-bind/implementation.js_commonjs-proxy.js +0 -1
  100. package/_vendor/function-bind/index.js_commonjs-proxy.js +0 -1
  101. package/_vendor/get-intrinsic/index.js_commonjs-proxy.js +0 -1
  102. package/_vendor/has/src/index.js_commonjs-proxy.js +0 -1
  103. package/_vendor/has-bigints/index.js_commonjs-proxy.js +0 -1
  104. package/_vendor/has-symbols/index.js_commonjs-proxy.js +0 -1
  105. package/_vendor/has-symbols/shams.js_commonjs-proxy.js +0 -1
  106. package/_vendor/has-tostringtag/shams.js_commonjs-proxy.js +0 -1
  107. package/_vendor/is-arguments/index.js_commonjs-proxy.js +0 -1
  108. package/_vendor/is-bigint/index.js_commonjs-module.js +0 -3
  109. package/_vendor/is-bigint/index.js_commonjs-proxy.js +0 -1
  110. package/_vendor/is-boolean-object/index.js_commonjs-proxy.js +0 -1
  111. package/_vendor/is-date-object/index.js_commonjs-proxy.js +0 -1
  112. package/_vendor/is-map/index.js_commonjs-proxy.js +0 -1
  113. package/_vendor/is-number-object/index.js_commonjs-proxy.js +0 -1
  114. package/_vendor/is-regex/index.js_commonjs-proxy.js +0 -1
  115. package/_vendor/is-set/index.js_commonjs-proxy.js +0 -1
  116. package/_vendor/is-string/index.js_commonjs-proxy.js +0 -1
  117. package/_vendor/is-symbol/index.js_commonjs-module.js +0 -3
  118. package/_vendor/is-symbol/index.js_commonjs-proxy.js +0 -1
  119. package/_vendor/is-typed-array/index.js_commonjs-proxy.js +0 -1
  120. package/_vendor/is-weakmap/index.js_commonjs-proxy.js +0 -1
  121. package/_vendor/is-weakset/index.js_commonjs-proxy.js +0 -1
  122. package/_vendor/object-inspect/index.js_commonjs-proxy.js +0 -1
  123. package/_vendor/object-is/implementation.js_commonjs-proxy.js +0 -1
  124. package/_vendor/object-is/index.js_commonjs-proxy.js +0 -1
  125. package/_vendor/object-is/polyfill.js_commonjs-proxy.js +0 -1
  126. package/_vendor/object-is/shim.js_commonjs-proxy.js +0 -1
  127. package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
  128. package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
  129. package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
  130. package/_vendor/object.assign/implementation.js_commonjs-proxy.js +0 -1
  131. package/_vendor/object.assign/index.js_commonjs-proxy.js +0 -1
  132. package/_vendor/object.assign/polyfill.js_commonjs-proxy.js +0 -1
  133. package/_vendor/object.assign/shim.js_commonjs-proxy.js +0 -2
  134. package/_vendor/regexp.prototype.flags/implementation.js_commonjs-proxy.js +0 -1
  135. package/_vendor/regexp.prototype.flags/index.js_commonjs-proxy.js +0 -1
  136. package/_vendor/regexp.prototype.flags/polyfill.js_commonjs-proxy.js +0 -1
  137. package/_vendor/regexp.prototype.flags/shim.js_commonjs-proxy.js +0 -1
  138. package/_vendor/side-channel/index.js_commonjs-proxy.js +0 -1
  139. package/_vendor/which-boxed-primitive/index.js_commonjs-proxy.js +0 -5
  140. package/_vendor/which-collection/index.js_commonjs-proxy.js +0 -4
  141. package/_vendor/which-typed-array/index.js_commonjs-proxy.js +0 -1
  142. package/_virtual/_node-resolve_empty.js_commonjs-proxy.js +0 -6
  143. package/_virtual/commonjsHelpers.js +0 -18
  144. package/_virtual/node-resolve_empty.js +0 -8
  145. package/_virtual/polyfill-node.global.js +0 -5
  146. package/_virtual/polyfill-node.process.js +0 -225
  147. package/vendor/available-typed-arrays/index.js +0 -29
  148. package/vendor/call-bind/callBound.js +0 -19
  149. package/vendor/call-bind/index.js +0 -52
  150. package/vendor/deep-equal/index.js +0 -379
  151. package/vendor/deep-equal/node_modules/isarray/index.js +0 -7
  152. package/vendor/define-properties/index.js +0 -60
  153. package/vendor/es-abstract/helpers/getOwnPropertyDescriptor.js +0 -17
  154. package/vendor/es-get-iterator/index.js +0 -217
  155. package/vendor/es-get-iterator/node_modules/isarray/index.js +0 -7
  156. package/vendor/foreach/index.js +0 -22
  157. package/vendor/function-bind/implementation.js +0 -52
  158. package/vendor/function-bind/index.js +0 -7
  159. package/vendor/get-intrinsic/index.js +0 -334
  160. package/vendor/has/src/index.js +0 -7
  161. package/vendor/has-bigints/index.js +0 -12
  162. package/vendor/has-symbols/index.js +0 -15
  163. package/vendor/has-symbols/shams.js +0 -42
  164. package/vendor/has-tostringtag/shams.js +0 -9
  165. package/vendor/is-arguments/index.js +0 -36
  166. package/vendor/is-bigint/index.js +0 -39
  167. package/vendor/is-boolean-object/index.js +0 -29
  168. package/vendor/is-date-object/index.js +0 -22
  169. package/vendor/is-map/index.js +0 -42
  170. package/vendor/is-number-object/index.js +0 -26
  171. package/vendor/is-regex/index.js +0 -61
  172. package/vendor/is-set/index.js +0 -42
  173. package/vendor/is-string/index.js +0 -26
  174. package/vendor/is-symbol/index.js +0 -36
  175. package/vendor/is-typed-array/index.js +0 -67
  176. package/vendor/is-weakmap/index.js +0 -42
  177. package/vendor/is-weakset/index.js +0 -42
  178. package/vendor/object-inspect/index.js +0 -515
  179. package/vendor/object-is/implementation.js +0 -18
  180. package/vendor/object-is/index.js +0 -25
  181. package/vendor/object-is/polyfill.js +0 -9
  182. package/vendor/object-is/shim.js +0 -17
  183. package/vendor/object-keys/implementation.js +0 -124
  184. package/vendor/object-keys/index.js +0 -35
  185. package/vendor/object-keys/isArguments.js +0 -17
  186. package/vendor/object.assign/implementation.js +0 -46
  187. package/vendor/object.assign/index.js +0 -29
  188. package/vendor/object.assign/polyfill.js +0 -57
  189. package/vendor/object.assign/shim.js +0 -17
  190. package/vendor/regexp.prototype.flags/implementation.js +0 -30
  191. package/vendor/regexp.prototype.flags/index.js +0 -25
  192. package/vendor/regexp.prototype.flags/polyfill.js +0 -23
  193. package/vendor/regexp.prototype.flags/shim.js +0 -29
  194. package/vendor/side-channel/index.js +0 -128
  195. package/vendor/which-boxed-primitive/index.js +0 -38
  196. package/vendor/which-collection/index.js +0 -29
  197. package/vendor/which-typed-array/index.js +0 -63
@@ -1,28 +0,0 @@
1
- var VerticalTextAlignment = {
2
- TOP: 'TOP',
3
- BOTTOM: 'BOTTOM',
4
- MIDDLE: 'MIDDLE'
5
- };
6
- /**
7
- * fontSize can be a number or a string representing a size in px
8
- * @param {Number|String} fontSize
9
- * @returns Number representing the fontSize in pixels
10
- */
11
-
12
- function fontSizeToPixels(fontProperties) {
13
- var defaultFontSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
14
-
15
- if (fontProperties != null && fontProperties.fontSize) {
16
- if (typeof fontProperties.fontSize === 'string') {
17
- if (fontProperties.fontSize.slice(-2) === 'px') {
18
- return window.devicePixelRatio * parseInt(fontProperties.fontSize, 10);
19
- }
20
- }
21
-
22
- return window.devicePixelRatio * fontProperties.fontSize;
23
- }
24
-
25
- return window.devicePixelRatio * defaultFontSize;
26
- }
27
-
28
- export { VerticalTextAlignment, VerticalTextAlignment as default, fontSizeToPixels };
@@ -1,179 +0,0 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import macro from '../../macros.js';
3
- import vtkSVGRepresentation from './SVGRepresentation.js';
4
- import { fontSizeToPixels, VerticalTextAlignment } from './SVGLandmarkRepresentation/Constants.js';
5
-
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
-
8
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
- var createSvgElement = vtkSVGRepresentation.createSvgElement; // ----------------------------------------------------------------------------
10
- // vtkSVGLandmarkRepresentation
11
- // ----------------------------------------------------------------------------
12
-
13
- function vtkSVGLandmarkRepresentation(publicAPI, model) {
14
- // Set our className
15
- model.classHierarchy.push('vtkSVGLandmarkRepresentation');
16
-
17
- publicAPI.render = function () {
18
- var list = publicAPI.getRepresentationStates();
19
-
20
- if (!list.length) {
21
- return createSvgElement('g');
22
- }
23
-
24
- var coords = [];
25
- var texts = [];
26
- list.forEach(function (state, index) {
27
- if (state.getOrigin && state.getOrigin() && state.getVisible && state.getVisible()) {
28
- coords.push(state.getOrigin());
29
- texts.push(state.getText ? state.getText() : "L".concat(index));
30
- }
31
- });
32
- var state = list[0];
33
- var isActive = state.getActive();
34
- return publicAPI.worldPointsToPixelSpace(coords).then(function (pixelSpace) {
35
- var points2d = pixelSpace.coords;
36
- var winHeight = pixelSpace.windowSize[1];
37
- var root = createSvgElement('g');
38
-
39
- var _loop = function _loop(i) {
40
- var xy = points2d[i];
41
-
42
- if (Number.isNaN(xy[0]) || Number.isNaN(xy[1])) {
43
- return "continue"; // eslint-disable-line
44
- }
45
-
46
- var x = xy[0];
47
- var y = winHeight - xy[1];
48
-
49
- if (model.circleProps && model.circleProps.visible) {
50
- var circle = publicAPI.createListenableSvgElement('circle', i);
51
- Object.keys(model.circleProps || {}).forEach(function (prop) {
52
- return circle.setAttribute(prop, model.circleProps[prop]);
53
- });
54
- circle.setAttribute('cx', x);
55
- circle.setAttribute('cy', y);
56
- root.appendChild(circle);
57
- }
58
-
59
- if (!texts[i]) {
60
- texts[i] = '';
61
- }
62
-
63
- var splitText = texts[i].split('\n');
64
- var fontSize = fontSizeToPixels(model.fontProperties);
65
- splitText.forEach(function (subText, j) {
66
- var _model$textProps, _model$textProps2;
67
-
68
- var text = publicAPI.createListenableSvgElement('text', i);
69
- Object.keys(model.textProps || {}).forEach(function (prop) {
70
- text.setAttribute(prop, model.textProps[prop]);
71
- });
72
- text.setAttribute('x', x);
73
- text.setAttribute('y', y); // Vertical offset (dy) calculation based on VerticalTextAlignment
74
-
75
- var dy = ((_model$textProps = model.textProps) === null || _model$textProps === void 0 ? void 0 : _model$textProps.dy) || 0;
76
-
77
- switch ((_model$textProps2 = model.textProps) === null || _model$textProps2 === void 0 ? void 0 : _model$textProps2.verticalAlign) {
78
- case VerticalTextAlignment.MIDDLE:
79
- dy -= fontSize * (0.5 * splitText.length - j - 1);
80
- break;
81
-
82
- case VerticalTextAlignment.TOP:
83
- dy += fontSize * (j + 1);
84
- break;
85
-
86
- case VerticalTextAlignment.BOTTOM:
87
- default:
88
- dy -= fontSize * (splitText.length - j - 1);
89
- break;
90
- }
91
-
92
- text.setAttribute('dy', dy);
93
- text.setAttribute('font-size', fontSize);
94
-
95
- if (model.fontProperties && model.fontProperties.fontFamily) {
96
- text.setAttribute('font-family', model.fontProperties.fontFamily);
97
- } else if (isActive && model.strokeFontProperties && model.strokeFontProperties.fontFamily) {
98
- text.setAttribute('font-family', model.strokeFontProperties.fontFamily);
99
- }
100
-
101
- if (model.fontProperties && model.fontProperties.fontStyle) {
102
- text.setAttribute('font-weight', model.fontProperties.fontStyle);
103
- } else if (isActive && model.strokeFontProperties && model.strokeFontProperties.fontStyle) {
104
- text.setAttribute('font-weight', model.strokeFontProperties.fontStyle);
105
- }
106
-
107
- if (model.fontProperties && model.fontProperties.fontColor) {
108
- text.setAttribute('fill', model.fontProperties.fontColor);
109
- } else if (isActive && model.strokeFontProperties && model.strokeFontProperties.fontColor) {
110
- text.setAttribute('fill', model.strokeFontProperties.fontColor);
111
- }
112
-
113
- text.textContent = subText;
114
- root.appendChild(text);
115
- });
116
- };
117
-
118
- for (var i = 0; i < points2d.length; i++) {
119
- var _ret = _loop(i);
120
-
121
- if (_ret === "continue") continue;
122
- }
123
-
124
- return root;
125
- });
126
- };
127
- } // ----------------------------------------------------------------------------
128
- // Object factory
129
- // ----------------------------------------------------------------------------
130
-
131
- /**
132
- * textProps can contain any "svg" attribute (e.g. text-anchor, text-align,
133
- * alignment-baseline...)
134
- */
135
-
136
-
137
- function defaultValues(initialValues) {
138
- return _objectSpread(_objectSpread({}, initialValues), {}, {
139
- circleProps: _objectSpread({
140
- visible: false,
141
- r: 5,
142
- stroke: 'red',
143
- fill: 'red'
144
- }, initialValues.circleProps),
145
- fontProperties: _objectSpread({
146
- fontColor: 'white'
147
- }, initialValues.fontProperties)
148
- });
149
- } // ----------------------------------------------------------------------------
150
-
151
-
152
- function extend(publicAPI, model) {
153
- var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
154
- vtkSVGRepresentation.extend(publicAPI, model, defaultValues(initialValues));
155
- macro.setGet(publicAPI, model, [{
156
- type: 'object',
157
- name: 'circleProps'
158
- }, {
159
- type: 'object',
160
- name: 'fontProperties'
161
- }, {
162
- type: 'object',
163
- name: 'strokeFontProperties'
164
- }, {
165
- type: 'object',
166
- name: 'textProps'
167
- }]); // Object specific methods
168
-
169
- vtkSVGLandmarkRepresentation(publicAPI, model);
170
- } // ----------------------------------------------------------------------------
171
-
172
- var newInstance = macro.newInstance(extend, 'vtkSVGLandmarkRepresentation'); // ----------------------------------------------------------------------------
173
-
174
- var vtkSVGLandmarkRepresentation$1 = {
175
- extend: extend,
176
- newInstance: newInstance
177
- };
178
-
179
- export { vtkSVGLandmarkRepresentation$1 as default, extend, newInstance };
@@ -1,163 +0,0 @@
1
- import macro from '../../macros.js';
2
- import vtkPolyData from '../../Common/DataModel/PolyData.js';
3
- import vtkActor from '../../Rendering/Core/Actor.js';
4
- import vtkPixelSpaceCallbackMapper from '../../Rendering/Core/PixelSpaceCallbackMapper.js';
5
- import vtkWidgetRepresentation from '../Representations/WidgetRepresentation.js';
6
- import { Behavior } from '../Representations/WidgetRepresentation/Constants.js';
7
- import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
8
-
9
- var SVG_XMLNS = 'http://www.w3.org/2000/svg'; // ----------------------------------------------------------------------------
10
-
11
- function createSvgElement(tag) {
12
- return {
13
- name: tag,
14
- attrs: {},
15
- eventListeners: {},
16
- // implies no children if set
17
- textContent: null,
18
- children: [],
19
- setAttribute: function setAttribute(attr, val) {
20
- this.attrs[attr] = val;
21
- },
22
- removeAttribute: function removeAttribute(attr) {
23
- delete this.attrs[attr];
24
- },
25
- appendChild: function appendChild(n) {
26
- this.children.push(n);
27
- },
28
- addEventListeners: function addEventListeners(event, callback) {
29
- this.eventListeners[event] = callback;
30
- }
31
- };
32
- } // ----------------------------------------------------------------------------
33
-
34
-
35
- function createSvgDomElement(tag) {
36
- return document.createElementNS(SVG_XMLNS, tag);
37
- } // ----------------------------------------------------------------------------
38
-
39
-
40
- function defer() {
41
- var resolve;
42
- var reject;
43
- var promise = new Promise(function (res, rej) {
44
- resolve = res;
45
- reject = rej;
46
- });
47
- return {
48
- promise: promise,
49
- resolve: resolve,
50
- reject: reject
51
- };
52
- } // ----------------------------------------------------------------------------
53
- // vtkSVGRepresentation
54
- // ----------------------------------------------------------------------------
55
-
56
-
57
- function vtkSVGRepresentation(publicAPI, model) {
58
- // Set our className
59
- model.classHierarchy.push('vtkSVGRepresentation');
60
- var deferred = null;
61
- model.psActor = vtkActor.newInstance({
62
- pickable: false,
63
- _parentProp: publicAPI
64
- });
65
- model.psMapper = vtkPixelSpaceCallbackMapper.newInstance();
66
- model.points = vtkPolyData.newInstance();
67
- model.psMapper.setInputData(model.points);
68
- model.psActor.setMapper(model.psMapper);
69
- model.psMapper.setCallback(function () {
70
- if (deferred) {
71
- var d = deferred;
72
- deferred = null;
73
- d.resolve({
74
- coords: arguments.length <= 0 ? undefined : arguments[0],
75
- camera: arguments.length <= 1 ? undefined : arguments[1],
76
- aspect: arguments.length <= 2 ? undefined : arguments[2],
77
- depthValues: arguments.length <= 3 ? undefined : arguments[3],
78
- windowSize: arguments.length <= 4 ? undefined : arguments[4]
79
- });
80
- }
81
- });
82
- publicAPI.addActor(model.psActor); // --------------------------------------------------------------------------
83
-
84
- publicAPI.worldPointsToPixelSpace = function (points3d) {
85
- var pts = new Float32Array(points3d.length * 3);
86
-
87
- for (var i = 0; i < points3d.length; i++) {
88
- pts[i * 3 + 0] = points3d[i][0];
89
- pts[i * 3 + 1] = points3d[i][1];
90
- pts[i * 3 + 2] = points3d[i][2];
91
- }
92
-
93
- model.points.getPoints().setData(pts);
94
- model.points.modified();
95
- deferred = defer();
96
- return deferred.promise;
97
- };
98
-
99
- publicAPI.createListenableSvgElement = function (tag, id) {
100
- var element = createSvgElement(tag);
101
-
102
- if (model.pickable) {
103
- element.addEventListeners('mouseenter', function () {
104
- publicAPI.setHover(id);
105
- });
106
- element.addEventListeners('mouseleave', function () {
107
- if (publicAPI.getHover() === id) {
108
- publicAPI.setHover(null);
109
- }
110
- });
111
- }
112
-
113
- return element;
114
- }; // --------------------------------------------------------------------------
115
-
116
-
117
- publicAPI.updateActorVisibility = function () {
118
- arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : RenderingTypes.FRONT_BUFFER;
119
- var ctxVisible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
120
- var handleVisible = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
121
-
122
- if (model.behavior === Behavior.CONTEXT) {
123
- publicAPI.setVisibility(ctxVisible);
124
- } else if (model.behavior === Behavior.HANDLE) {
125
- publicAPI.setVisibility(handleVisible);
126
- }
127
- }; // --------------------------------------------------------------------------
128
- // Subclasses must implement this method
129
-
130
-
131
- publicAPI.render = function () {
132
- throw new Error('Not implemented');
133
- };
134
- } // ----------------------------------------------------------------------------
135
- // Object factory
136
- // ----------------------------------------------------------------------------
137
-
138
- /**
139
- * 'hover' is not null when a pickable SVG element is mouse hovered.
140
- */
141
-
142
-
143
- var DEFAULT_VALUES = {
144
- visibility: true
145
- }; // ----------------------------------------------------------------------------
146
-
147
- function extend(publicAPI, model) {
148
- var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
149
- Object.assign(model, DEFAULT_VALUES, initialValues); // Extend methods
150
-
151
- vtkWidgetRepresentation.extend(publicAPI, model, initialValues);
152
- macro.setGet(publicAPI, model, ['visibility', 'hover']); // Object specific methods
153
-
154
- vtkSVGRepresentation(publicAPI, model);
155
- } // ----------------------------------------------------------------------------
156
-
157
- var vtkSVGRepresentation$1 = {
158
- extend: extend,
159
- createSvgElement: createSvgElement,
160
- createSvgDomElement: createSvgDomElement
161
- };
162
-
163
- export { vtkSVGRepresentation$1 as default, extend };
@@ -1 +0,0 @@
1
- import '../../vendor/call-bind/callBound.js';
@@ -1,3 +0,0 @@
1
- var callBind = {exports: {}};
2
-
3
- export { callBind as c };
@@ -1 +0,0 @@
1
- import '../../vendor/call-bind/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/define-properties/index.js';
@@ -1,3 +0,0 @@
1
- var esGetIterator = {exports: {}};
2
-
3
- export { esGetIterator as e };
@@ -1 +0,0 @@
1
- import '../../vendor/es-get-iterator/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/get-intrinsic/index.js';
@@ -1 +0,0 @@
1
- import '../../../vendor/has/src/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/has-bigints/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-arguments/index.js';
@@ -1,3 +0,0 @@
1
- var isBigint = {exports: {}};
2
-
3
- export { isBigint as i };
@@ -1 +0,0 @@
1
- import '../../vendor/is-bigint/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-boolean-object/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-map/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-number-object/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-regex/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-set/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-string/index.js';
@@ -1,3 +0,0 @@
1
- var isSymbol = {exports: {}};
2
-
3
- export { isSymbol as i };
@@ -1 +0,0 @@
1
- import '../../vendor/is-symbol/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-typed-array/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-weakmap/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/is-weakset/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/object-is/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/define-properties/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/object-keys/implementation.js';
@@ -1 +0,0 @@
1
- import '../../vendor/object-keys/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/object.assign/implementation.js';
@@ -1 +0,0 @@
1
- import '../../vendor/object.assign/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/object.assign/implementation.js';
@@ -1,2 +0,0 @@
1
- import '../../vendor/define-properties/index.js';
2
- import '../../vendor/object.assign/implementation.js';
@@ -1 +0,0 @@
1
- import '../../vendor/regexp.prototype.flags/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/define-properties/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/define-properties/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/side-channel/index.js';
@@ -1,5 +0,0 @@
1
- import '../../vendor/is-string/index.js';
2
- import '../../vendor/is-number-object/index.js';
3
- import '../../vendor/is-boolean-object/index.js';
4
- import '../../vendor/is-symbol/index.js';
5
- import '../../vendor/is-bigint/index.js';
@@ -1,4 +0,0 @@
1
- import '../../vendor/is-map/index.js';
2
- import '../../vendor/is-set/index.js';
3
- import '../../vendor/is-weakmap/index.js';
4
- import '../../vendor/is-weakset/index.js';
@@ -1 +0,0 @@
1
- import '../../vendor/which-typed-array/index.js';
@@ -1,6 +0,0 @@
1
- import { _ as _nodeResolve_empty } from './node-resolve_empty.js';
2
- import { g as getAugmentedNamespace } from './commonjsHelpers.js';
3
-
4
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty);
5
-
6
- export { require$$0 as r };
@@ -1,18 +0,0 @@
1
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
-
3
- function getAugmentedNamespace(n) {
4
- if (n.__esModule) return n;
5
- var a = Object.defineProperty({}, '__esModule', {value: true});
6
- Object.keys(n).forEach(function (k) {
7
- var d = Object.getOwnPropertyDescriptor(n, k);
8
- Object.defineProperty(a, k, d.get ? d : {
9
- enumerable: true,
10
- get: function () {
11
- return n[k];
12
- }
13
- });
14
- });
15
- return a;
16
- }
17
-
18
- export { commonjsGlobal as c, getAugmentedNamespace as g };
@@ -1,8 +0,0 @@
1
- var _nodeResolve_empty = {};
2
-
3
- var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': _nodeResolve_empty
6
- });
7
-
8
- export { _nodeResolve_empty$1 as _ };
@@ -1,5 +0,0 @@
1
- var global$1 = (typeof global !== "undefined" ? global :
2
- typeof self !== "undefined" ? self :
3
- typeof window !== "undefined" ? window : {});
4
-
5
- export { global$1 as g };