@kitware/vtk.js 23.4.0 → 24.0.0-beta.1
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/BREAKING_CHANGES.md +33 -0
- package/Common/Core/DataArray.js +4 -0
- package/Common/Core/Math/index.js +2 -2
- package/Common/Core/Math.js +1 -1
- package/Common/DataModel/BoundingBox.js +3 -8
- package/Common/DataModel/DataSetAttributes/FieldData.js +9 -5
- package/Common/DataModel/ITKHelper.js +2 -346
- package/Common/DataModel/ImageData.d.ts +23 -6
- package/Common/DataModel/ImageData.js +8 -1
- package/Common/DataModel/PolyData.d.ts +8 -1
- package/Common/DataModel/PolyData.js +5 -3
- package/Common/DataModel/Triangle.js +217 -2
- package/Common/Transform/LandmarkTransform.js +1 -1
- package/Filters/General/OBBTree/OBBNode.js +82 -0
- package/Filters/General/OBBTree/helper.js +92 -0
- package/Filters/General/OBBTree.js +1249 -0
- package/Filters/General/WindowedSincPolyDataFilter.js +1 -1
- package/Filters/General.js +2 -0
- package/Filters/Sources/CircleSource.js +1 -1
- package/Filters/Sources/PointSource.js +1 -1
- package/Filters/Texture/TextureMapToPlane.js +1 -1
- package/Interaction/Manipulators/KeyboardCameraManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleImage.js +3 -3
- package/Interaction/Style/InteractorStyleMPRSlice.js +12 -6
- package/Interaction/Style/InteractorStyleManipulator.js +42 -28
- package/Interaction/Style/InteractorStyleRemoteMouse.js +32 -14
- package/Interaction/Style/InteractorStyleTrackballCamera.js +7 -7
- package/Interaction/Widgets/OrientationMarkerWidget.js +18 -13
- package/Interaction/Widgets/PiecewiseGaussianWidget.js +1 -1
- package/Interaction/Widgets.js +1 -35
- package/Proxy/Core/View2DProxy.js +1 -1
- package/Rendering/Core/ColorTransferFunction.js +1 -1
- package/Rendering/Core/Coordinate.js +1 -1
- package/Rendering/Core/CubeAxesActor.js +1 -1
- package/Rendering/Core/Glyph3DMapper.js +1 -1
- package/Rendering/Core/ImageMapper.js +1 -1
- package/Rendering/Core/InteractorObserver.js +11 -10
- package/Rendering/Core/InteractorStyle.js +9 -4
- package/Rendering/Core/Mapper.js +1 -1
- package/Rendering/Core/Prop.js +6 -4
- package/Rendering/Core/Prop3D.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.js +24 -17
- package/Rendering/Core/Renderer.js +24 -19
- package/Rendering/Core/ScalarBarActor.js +1 -1
- package/Rendering/Core/Viewport.js +1 -1
- package/Rendering/Core/VolumeMapper.js +1 -1
- package/Rendering/OpenGL/Actor.js +2 -2
- package/Rendering/OpenGL/Actor2D.js +2 -2
- package/Rendering/OpenGL/BufferObject.js +6 -5
- package/Rendering/OpenGL/Camera.js +3 -3
- package/Rendering/OpenGL/CellArrayBufferObject.js +1 -1
- package/Rendering/OpenGL/Framebuffer.js +13 -12
- package/Rendering/OpenGL/Glyph3DMapper.js +10 -8
- package/Rendering/OpenGL/HardwareSelector.js +35 -25
- package/Rendering/OpenGL/ImageMapper.js +51 -45
- package/Rendering/OpenGL/ImageSlice.js +2 -2
- package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +4 -2
- package/Rendering/OpenGL/PolyDataMapper.js +14 -11
- package/Rendering/OpenGL/PolyDataMapper2D.js +17 -16
- package/Rendering/OpenGL/Renderer.js +11 -7
- package/Rendering/OpenGL/ReplacementShaderMapper.js +1 -1
- package/Rendering/OpenGL/ScalarBarActor.js +2 -2
- package/Rendering/OpenGL/ShaderCache.js +7 -5
- package/Rendering/OpenGL/Skybox.js +11 -9
- package/Rendering/OpenGL/SphereMapper.js +2 -2
- package/Rendering/OpenGL/StickMapper.js +2 -2
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D/pingpong.js +13 -12
- package/Rendering/OpenGL/SurfaceLIC/LineIntegralConvolution2D.js +11 -9
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICInterface.js +19 -12
- package/Rendering/OpenGL/SurfaceLIC/SurfaceLICMapper.js +9 -6
- package/Rendering/OpenGL/Texture.js +44 -31
- package/Rendering/OpenGL/VertexArrayObject.js +7 -7
- package/Rendering/OpenGL/Volume.js +3 -2
- package/Rendering/OpenGL/VolumeMapper.js +30 -26
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/SceneGraph/ViewNode.js +8 -7
- package/Rendering/WebGPU/Renderer.js +18 -10
- package/Widgets/Core/AbstractWidget.js +5 -4
- package/Widgets/Core/AbstractWidgetFactory.js +2 -1
- package/Widgets/Core/WidgetManager.js +66 -49
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Representations/CircleContextRepresentation.js +1 -1
- package/Widgets/Representations/ImplicitPlaneRepresentation.js +5 -5
- package/Widgets/Representations/PolyLineRepresentation.js +1 -1
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +7 -7
- package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +2 -2
- package/Widgets/SVG/SVGLandmarkRepresentation.js +21 -8
- package/Widgets/SVG/SVGRepresentation.js +1 -1
- package/Widgets/Widgets3D/AngleWidget/behavior.js +14 -6
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +14 -6
- package/Widgets/Widgets3D/EllipseWidget.js +0 -1
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +6 -2
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +4 -2
- package/Widgets/Widgets3D/LabelWidget/behavior.js +138 -0
- package/Widgets/Widgets3D/LabelWidget/state.js +22 -0
- package/Widgets/Widgets3D/LabelWidget.js +79 -0
- package/Widgets/Widgets3D/LineWidget/behavior.js +18 -9
- package/Widgets/Widgets3D/LineWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/LineWidget.js +0 -1
- package/Widgets/Widgets3D/PaintWidget/behavior.js +5 -3
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +18 -8
- package/Widgets/Widgets3D/RectangleWidget.js +0 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +1 -1
- package/Widgets/Widgets3D/ResliceCursorWidget.js +1 -1
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +18 -11
- package/Widgets/Widgets3D/SplineWidget/behavior.js +33 -21
- package/index.d.ts +3 -4
- package/interfaces.d.ts +11 -0
- package/macros.d.ts +26 -1
- package/macros.js +51 -19
- package/package.json +1 -1
- package/types.d.ts +1 -0
- package/Interaction/Widgets/AbstractWidget.js +0 -104
- package/Interaction/Widgets/DistanceRepresentation.js +0 -116
- package/Interaction/Widgets/DistanceWidget.js +0 -77
- package/Interaction/Widgets/HandleRepresentation/Constants.js +0 -12
- package/Interaction/Widgets/HandleRepresentation.js +0 -100
- package/Interaction/Widgets/HandleWidget/Constants.js +0 -9
- package/Interaction/Widgets/HandleWidget.js +0 -194
- package/Interaction/Widgets/ImageCroppingRegionsRepresentation.js +0 -233
- package/Interaction/Widgets/ImageCroppingRegionsWidget/Constants.js +0 -16
- package/Interaction/Widgets/ImageCroppingRegionsWidget.js +0 -573
- package/Interaction/Widgets/LabelRepresentation/Constants.js +0 -17
- package/Interaction/Widgets/LabelRepresentation.js +0 -325
- package/Interaction/Widgets/LabelWidget.js +0 -65
- package/Interaction/Widgets/LineRepresentation/Constants.js +0 -21
- package/Interaction/Widgets/LineRepresentation.js +0 -498
- package/Interaction/Widgets/LineWidget/Constants.js +0 -11
- package/Interaction/Widgets/LineWidget.js +0 -296
- package/Interaction/Widgets/PointPlacer.js +0 -51
- package/Interaction/Widgets/ResliceCursor/ResliceCursor/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursor.js +0 -269
- package/Interaction/Widgets/ResliceCursor/ResliceCursorActor/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursorActor.js +0 -146
- package/Interaction/Widgets/ResliceCursor/ResliceCursorLineRepresentation.js +0 -332
- package/Interaction/Widgets/ResliceCursor/ResliceCursorPolyDataAlgorithm.js +0 -134
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation/Constants.js +0 -16
- package/Interaction/Widgets/ResliceCursor/ResliceCursorRepresentation.js +0 -371
- package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget/Constants.js +0 -10
- package/Interaction/Widgets/ResliceCursor/ResliceCursorWidget.js +0 -157
- package/Interaction/Widgets/SphereHandleRepresentation.js +0 -370
- package/Interaction/Widgets/WidgetRepresentation.js +0 -121
- package/Widgets/Representations/SphereContextRepresentation.js +0 -131
- package/Widgets/Widgets3D/SphereWidget/behavior.js +0 -177
- package/Widgets/Widgets3D/SphereWidget/state.js +0 -45
- package/Widgets/Widgets3D/SphereWidget.d.ts +0 -50
- package/Widgets/Widgets3D/SphereWidget.js +0 -62
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import macro from '../../macros.js';
|
|
3
|
-
import vtkActor from '../../Rendering/Core/Actor.js';
|
|
4
|
-
import vtkInteractorObserver from '../../Rendering/Core/InteractorObserver.js';
|
|
5
|
-
import { g as subtract, k as add } from '../../Common/Core/Math/index.js';
|
|
6
|
-
import vtkPixelSpaceCallbackMapper from '../../Rendering/Core/PixelSpaceCallbackMapper.js';
|
|
7
|
-
import vtkPointSource from '../../Filters/Sources/PointSource.js';
|
|
8
|
-
import vtkHandleRepresentation from './HandleRepresentation.js';
|
|
9
|
-
import { TextAlign, VerticalAlign } from './LabelRepresentation/Constants.js';
|
|
10
|
-
import { InteractionState } from './HandleRepresentation/Constants.js';
|
|
11
|
-
|
|
12
|
-
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; }
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
// vtkLabelRepresentation methods
|
|
16
|
-
// ----------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
function vtkLabelRepresentation(publicAPI, model) {
|
|
19
|
-
// Set our className
|
|
20
|
-
model.classHierarchy.push('vtkLabelRepresentation');
|
|
21
|
-
|
|
22
|
-
var superClass = _objectSpread({}, publicAPI);
|
|
23
|
-
|
|
24
|
-
function getCanvasPosition() {
|
|
25
|
-
if (model.canvas) {
|
|
26
|
-
// canvas left/bottom in CSS coords
|
|
27
|
-
var dpr = window.devicePixelRatio;
|
|
28
|
-
return {
|
|
29
|
-
left: Number(model.canvas.style.left.split('px')[0]) * dpr,
|
|
30
|
-
bottom: Number(model.canvas.style.bottom.split('px')[0]) * dpr
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
publicAPI.buildRepresentation = function () {
|
|
38
|
-
if (model.labelText !== null) {
|
|
39
|
-
publicAPI.setLabelText(model.labelText);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
publicAPI.modified();
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
publicAPI.getActors = function () {
|
|
46
|
-
return [model.actor];
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
publicAPI.getNestedProps = function () {
|
|
50
|
-
return publicAPI.getActors();
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
publicAPI.computeInteractionState = function (pos) {
|
|
54
|
-
if (model.canvas) {
|
|
55
|
-
var dpr = window.devicePixelRatio || 1;
|
|
56
|
-
var height = model.canvas.height * dpr;
|
|
57
|
-
var width = model.canvas.width * dpr;
|
|
58
|
-
var canvasPosition = getCanvasPosition(); // pos is in display coords
|
|
59
|
-
|
|
60
|
-
if (pos[0] >= canvasPosition.left && pos[0] <= canvasPosition.left + width && pos[1] >= canvasPosition.bottom && pos[1] <= canvasPosition.bottom + height) {
|
|
61
|
-
model.interactionState = InteractionState.SELECTING;
|
|
62
|
-
} else {
|
|
63
|
-
model.interactionState = InteractionState.OUTSIDE;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return model.interactionState;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
publicAPI.startComplexWidgetInteraction = function (startEventPos) {
|
|
71
|
-
// Record the current event position, and the rectilinear wipe position.
|
|
72
|
-
model.startEventPosition[0] = startEventPos[0];
|
|
73
|
-
model.startEventPosition[1] = startEventPos[1];
|
|
74
|
-
model.startEventPosition[2] = 0.0;
|
|
75
|
-
model.lastEventPosition[0] = startEventPos[0];
|
|
76
|
-
model.lastEventPosition[1] = startEventPos[1];
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
publicAPI.complexWidgetInteraction = function (eventPos) {
|
|
80
|
-
if (model.interactionState === InteractionState.SELECTING) {
|
|
81
|
-
var center = model.point.getCenter();
|
|
82
|
-
var displayCenter = vtkInteractorObserver.computeWorldToDisplay(model.renderer, center[0], center[1], center[2]);
|
|
83
|
-
var focalDepth = displayCenter[2];
|
|
84
|
-
var worldStartEventPosition = vtkInteractorObserver.computeDisplayToWorld(model.renderer, model.lastEventPosition[0], model.lastEventPosition[1], focalDepth);
|
|
85
|
-
var worldCurrentPosition = vtkInteractorObserver.computeDisplayToWorld(model.renderer, eventPos[0], eventPos[1], focalDepth);
|
|
86
|
-
publicAPI.moveFocus(worldStartEventPosition, worldCurrentPosition);
|
|
87
|
-
model.lastEventPosition[0] = eventPos[0];
|
|
88
|
-
model.lastEventPosition[1] = eventPos[1];
|
|
89
|
-
publicAPI.modified();
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
publicAPI.setWorldPosition = function (position) {
|
|
94
|
-
model.point.setCenter(position);
|
|
95
|
-
superClass.setWorldPosition(model.point.getCenter());
|
|
96
|
-
publicAPI.modified();
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
publicAPI.setDisplayPosition = function (position) {
|
|
100
|
-
superClass.setDisplayPosition(position);
|
|
101
|
-
publicAPI.setWorldPosition(model.worldPosition.getValue());
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
publicAPI.moveFocus = function (start, end) {
|
|
105
|
-
var motionVector = [];
|
|
106
|
-
subtract(end, start, motionVector);
|
|
107
|
-
var focus = model.point.getCenter();
|
|
108
|
-
add(focus, motionVector, focus);
|
|
109
|
-
publicAPI.setWorldPosition(focus);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
publicAPI.getBounds = function () {
|
|
113
|
-
var center = model.point.getCenter();
|
|
114
|
-
var bounds = [];
|
|
115
|
-
bounds[0] = model.placeFactor * (center[0] - 1);
|
|
116
|
-
bounds[1] = model.placeFactor * (center[0] + 1);
|
|
117
|
-
bounds[2] = model.placeFactor * (center[1] - 1);
|
|
118
|
-
bounds[3] = model.placeFactor * (center[1] + 1);
|
|
119
|
-
bounds[4] = model.placeFactor * (center[2] - 1);
|
|
120
|
-
bounds[5] = model.placeFactor * (center[2] + 1);
|
|
121
|
-
return bounds;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
publicAPI.setContainer = function (container) {
|
|
125
|
-
if (model.container && model.container !== container) {
|
|
126
|
-
model.container.removeChild(model.canvas);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (model.container !== container) {
|
|
130
|
-
model.container = container;
|
|
131
|
-
|
|
132
|
-
if (model.container) {
|
|
133
|
-
model.container.appendChild(model.canvas);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
publicAPI.modified();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
publicAPI.setLabelStyle = function (labelStyle) {
|
|
141
|
-
model.labelStyle = _objectSpread(_objectSpread({}, model.labelStyle), labelStyle);
|
|
142
|
-
publicAPI.modified();
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
publicAPI.setSelectLabelStyle = function (selectLabelStyle) {
|
|
146
|
-
model.selectLabelStyle = _objectSpread(_objectSpread({}, model.selectLabelStyle), selectLabelStyle);
|
|
147
|
-
publicAPI.modified();
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
publicAPI.computeTextDimensions = function (text) {
|
|
151
|
-
var currentLabelStyle = model.highlight ? model.selectLabelStyle : model.labelStyle;
|
|
152
|
-
var separatorRegExp = /\r?\n/;
|
|
153
|
-
var separatorRes = separatorRegExp.exec(text);
|
|
154
|
-
var separator = separatorRes !== null ? separatorRes[0] : null;
|
|
155
|
-
var lines = text.split(separator);
|
|
156
|
-
var lineSpace = currentLabelStyle.fontSize * (1 + currentLabelStyle.lineSpace);
|
|
157
|
-
var padding = currentLabelStyle.fontSize / 4;
|
|
158
|
-
var height = 2 * padding + currentLabelStyle.fontSize + (lines.length - 1) * lineSpace;
|
|
159
|
-
var width = lines.reduce(function (maxWidth, line) {
|
|
160
|
-
return Math.max(maxWidth, Math.round(model.context.measureText(line).width));
|
|
161
|
-
}, 0);
|
|
162
|
-
return {
|
|
163
|
-
width: width,
|
|
164
|
-
height: height,
|
|
165
|
-
lineSpace: lineSpace,
|
|
166
|
-
padding: padding,
|
|
167
|
-
lines: lines
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
publicAPI.updateLabel = function () {
|
|
172
|
-
if (model.context && model.canvas) {
|
|
173
|
-
// Clear canvas
|
|
174
|
-
model.context.clearRect(0, 0, model.canvas.width, model.canvas.height);
|
|
175
|
-
model.canvas.hidden = !model.actor.getVisibility(); // Render text
|
|
176
|
-
|
|
177
|
-
if (model.actor.getVisibility()) {
|
|
178
|
-
var currentLabelStyle = model.highlight ? model.selectLabelStyle : model.labelStyle;
|
|
179
|
-
|
|
180
|
-
var _publicAPI$computeTex = publicAPI.computeTextDimensions(model.labelText),
|
|
181
|
-
width = _publicAPI$computeTex.width,
|
|
182
|
-
height = _publicAPI$computeTex.height,
|
|
183
|
-
lineSpace = _publicAPI$computeTex.lineSpace,
|
|
184
|
-
padding = _publicAPI$computeTex.padding,
|
|
185
|
-
lines = _publicAPI$computeTex.lines;
|
|
186
|
-
|
|
187
|
-
model.canvas.height = Math.round(height);
|
|
188
|
-
model.canvas.width = width + 2 * padding; // Update label style
|
|
189
|
-
|
|
190
|
-
model.context.strokeStyle = currentLabelStyle.strokeColor;
|
|
191
|
-
model.context.lineWidth = currentLabelStyle.strokeSize;
|
|
192
|
-
model.context.fillStyle = currentLabelStyle.fontColor;
|
|
193
|
-
model.context.font = "".concat(currentLabelStyle.fontStyle, " ").concat(currentLabelStyle.fontSize, "px ").concat(currentLabelStyle.fontFamily); // Update canvas dimensions
|
|
194
|
-
|
|
195
|
-
var x = padding;
|
|
196
|
-
var y = currentLabelStyle.fontSize; // Add text
|
|
197
|
-
|
|
198
|
-
lines.forEach(function (line) {
|
|
199
|
-
var offset = 0;
|
|
200
|
-
|
|
201
|
-
if (model.textAlign === TextAlign.RIGHT) {
|
|
202
|
-
offset = width - Math.round(model.context.measureText(line).width);
|
|
203
|
-
} else if (model.textAlign === TextAlign.CENTER) {
|
|
204
|
-
offset = 0.5 * (width - Math.round(model.context.measureText(line).width));
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
model.context.strokeText(line, x + offset, y);
|
|
208
|
-
model.context.fillText(line, x + offset, y);
|
|
209
|
-
y += lineSpace;
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
publicAPI.highlight = function (highlight) {
|
|
216
|
-
model.highlight = highlight;
|
|
217
|
-
publicAPI.modified();
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
publicAPI.getCanvasSize = function () {
|
|
221
|
-
if (model.canvas) {
|
|
222
|
-
return {
|
|
223
|
-
height: model.canvas.height,
|
|
224
|
-
width: model.canvas.width
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return null;
|
|
229
|
-
};
|
|
230
|
-
} // ----------------------------------------------------------------------------
|
|
231
|
-
// Object factory
|
|
232
|
-
// ----------------------------------------------------------------------------
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
function defaultValues(initialValues) {
|
|
236
|
-
return _objectSpread({
|
|
237
|
-
container: null,
|
|
238
|
-
labelStyle: {
|
|
239
|
-
fontColor: 'white',
|
|
240
|
-
fontStyle: 'normal',
|
|
241
|
-
fontSize: 15,
|
|
242
|
-
fontFamily: 'Arial',
|
|
243
|
-
strokeColor: 'black',
|
|
244
|
-
strokeSize: 1,
|
|
245
|
-
lineSpace: 0.2
|
|
246
|
-
},
|
|
247
|
-
labelText: '',
|
|
248
|
-
textAlign: TextAlign.LEFT,
|
|
249
|
-
verticalAlign: VerticalAlign.BOTTOM,
|
|
250
|
-
selectLabelStyle: {
|
|
251
|
-
fontColor: 'rgb(0, 255, 0)',
|
|
252
|
-
fontStyle: 'normal',
|
|
253
|
-
fontSize: 15,
|
|
254
|
-
fontFamily: 'Arial',
|
|
255
|
-
strokeColor: 'black',
|
|
256
|
-
strokeSize: 1,
|
|
257
|
-
lineSpace: 0.2
|
|
258
|
-
}
|
|
259
|
-
}, initialValues);
|
|
260
|
-
} // ----------------------------------------------------------------------------
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
function extend(publicAPI, model) {
|
|
264
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
265
|
-
Object.assign(model, defaultValues(initialValues)); // Inheritance
|
|
266
|
-
|
|
267
|
-
vtkHandleRepresentation.extend(publicAPI, model, initialValues);
|
|
268
|
-
publicAPI.setPlaceFactor(1); // Canvas
|
|
269
|
-
|
|
270
|
-
model.canvas = document.createElement('canvas');
|
|
271
|
-
model.canvas.style.position = 'absolute'; // Context
|
|
272
|
-
|
|
273
|
-
model.context = model.canvas.getContext('2d'); // PixelSpaceCallbackMapper
|
|
274
|
-
|
|
275
|
-
model.point = vtkPointSource.newInstance();
|
|
276
|
-
model.point.setNumberOfPoints(1);
|
|
277
|
-
model.point.setRadius(0);
|
|
278
|
-
model.mapper = vtkPixelSpaceCallbackMapper.newInstance();
|
|
279
|
-
model.mapper.setInputConnection(model.point.getOutputPort());
|
|
280
|
-
model.mapper.setCallback(function (coordList) {
|
|
281
|
-
if (model.canvas) {
|
|
282
|
-
var yOffset = 0;
|
|
283
|
-
|
|
284
|
-
if (model.verticalAlign === VerticalAlign.BOTTOM) {
|
|
285
|
-
yOffset = -model.canvas.height;
|
|
286
|
-
} else if (model.verticalAlign === VerticalAlign.CENTER) {
|
|
287
|
-
yOffset = -0.5 * model.canvas.height;
|
|
288
|
-
} // coordList[0] is in display coords
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
var dpr = window.devicePixelRatio;
|
|
292
|
-
model.canvas.style.left = "".concat(Math.round(coordList[0][0]) / dpr, "px");
|
|
293
|
-
model.canvas.style.bottom = "".concat(Math.round(coordList[0][1] / dpr + yOffset), "px");
|
|
294
|
-
publicAPI.modified();
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
model.actor = vtkActor.newInstance({
|
|
298
|
-
parentProp: publicAPI
|
|
299
|
-
});
|
|
300
|
-
model.actor.setMapper(model.mapper);
|
|
301
|
-
model.actorVisibility = true;
|
|
302
|
-
model.highlight = false;
|
|
303
|
-
model.actor.onModified(function () {
|
|
304
|
-
if (model.actorVisibility !== model.actor.getVisibility()) {
|
|
305
|
-
model.actorVisibility = model.actor.getVisibility();
|
|
306
|
-
publicAPI.modified();
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
publicAPI.onModified(function () {
|
|
310
|
-
publicAPI.updateLabel();
|
|
311
|
-
});
|
|
312
|
-
macro.setGet(publicAPI, model, ['labelText', 'textAlign', 'verticalAlign']);
|
|
313
|
-
macro.get(publicAPI, model, ['container', 'labelStyle']); // Object methods
|
|
314
|
-
|
|
315
|
-
vtkLabelRepresentation(publicAPI, model);
|
|
316
|
-
} // ----------------------------------------------------------------------------
|
|
317
|
-
|
|
318
|
-
var newInstance = macro.newInstance(extend, 'vtkLabelRepresentation'); // ----------------------------------------------------------------------------
|
|
319
|
-
|
|
320
|
-
var vtkLabelRepresentation$1 = {
|
|
321
|
-
newInstance: newInstance,
|
|
322
|
-
extend: extend
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
export { vtkLabelRepresentation$1 as default, extend, newInstance };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import macro from '../../macros.js';
|
|
3
|
-
import vtkHandleWidget from './HandleWidget.js';
|
|
4
|
-
import vtkLabelRepresentation from './LabelRepresentation.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 VOID = macro.VOID; // ----------------------------------------------------------------------------
|
|
10
|
-
// vtkLabelWidget methods
|
|
11
|
-
// ----------------------------------------------------------------------------
|
|
12
|
-
|
|
13
|
-
function vtkLabelWidget(publicAPI, model) {
|
|
14
|
-
// // Set our className
|
|
15
|
-
model.classHierarchy.push('vtkLabelWidget');
|
|
16
|
-
|
|
17
|
-
var superClass = _objectSpread({}, publicAPI);
|
|
18
|
-
|
|
19
|
-
publicAPI.createDefaultRepresentation = function () {
|
|
20
|
-
if (!model.widgetRep) {
|
|
21
|
-
model.widgetRep = vtkLabelRepresentation.newInstance();
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
publicAPI.setEnabled = function (enabling) {
|
|
26
|
-
if (!enabling && model.widgetRep) {
|
|
27
|
-
// Remove label
|
|
28
|
-
model.widgetRep.setContainer(null);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
superClass.setEnabled(enabling);
|
|
32
|
-
|
|
33
|
-
if (enabling) {
|
|
34
|
-
var container = model.interactor ? model.interactor.getContainer() : null;
|
|
35
|
-
model.widgetRep.setContainer(container);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
publicAPI.scaleAction = function (callData) {
|
|
40
|
-
return VOID;
|
|
41
|
-
};
|
|
42
|
-
} // ----------------------------------------------------------------------------
|
|
43
|
-
// Object factory
|
|
44
|
-
// ----------------------------------------------------------------------------
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
|
|
48
|
-
|
|
49
|
-
function extend(publicAPI, model) {
|
|
50
|
-
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
51
|
-
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
52
|
-
|
|
53
|
-
vtkHandleWidget.extend(publicAPI, model, initialValues); // Object methods
|
|
54
|
-
|
|
55
|
-
vtkLabelWidget(publicAPI, model);
|
|
56
|
-
} // ----------------------------------------------------------------------------
|
|
57
|
-
|
|
58
|
-
var newInstance = macro.newInstance(extend, 'vtkLabelWidget'); // ----------------------------------------------------------------------------
|
|
59
|
-
|
|
60
|
-
var vtkLabelWidget$1 = {
|
|
61
|
-
newInstance: newInstance,
|
|
62
|
-
extend: extend
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { vtkLabelWidget$1 as default, extend, newInstance };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var State = {
|
|
2
|
-
OUTSIDE: 0,
|
|
3
|
-
ONP1: 1,
|
|
4
|
-
ONP2: 2,
|
|
5
|
-
TRANSLATINGP1: 3,
|
|
6
|
-
TRANSLATINGP2: 4,
|
|
7
|
-
ONLINE: 5,
|
|
8
|
-
SCALING: 6
|
|
9
|
-
};
|
|
10
|
-
var Restrict = {
|
|
11
|
-
NONE: 0,
|
|
12
|
-
X: 1,
|
|
13
|
-
Y: 2,
|
|
14
|
-
Z: 3
|
|
15
|
-
};
|
|
16
|
-
var Constants = {
|
|
17
|
-
State: State,
|
|
18
|
-
Restrict: Restrict
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export { Restrict, State, Constants as default };
|