@kitware/vtk.js 25.1.1 → 25.2.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/Rendering/Core/Light.d.ts +36 -2
- package/Rendering/Core/Light.js +10 -4
- package/Rendering/Core/Property.d.ts +120 -0
- package/Rendering/Core/Property.js +17 -1
- package/Rendering/Core/Texture.js +31 -0
- package/Rendering/WebGPU/Actor2D.js +2 -0
- package/Rendering/WebGPU/BufferManager.js +1 -1
- package/Rendering/WebGPU/CellArrayMapper.js +220 -50
- package/Rendering/WebGPU/Glyph3DMapper.js +2 -1
- package/Rendering/WebGPU/Renderer.js +109 -4
- package/Rendering/WebGPU/SphereMapper.js +2 -2
- package/Rendering/WebGPU/StickMapper.js +2 -2
- package/Rendering/WebGPU/Texture.js +8 -0
- package/Rendering/WebGPU/Types.js +3 -3
- package/Widgets/Core/AbstractWidgetFactory.js +8 -8
- package/Widgets/Widgets3D/AngleWidget.js +8 -4
- package/Widgets/Widgets3D/DistanceWidget.js +8 -4
- package/Widgets/Widgets3D/EllipseWidget.js +2 -2
- package/Widgets/Widgets3D/ImageCroppingWidget.js +10 -6
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +12 -4
- package/Widgets/Widgets3D/InteractiveOrientationWidget.js +12 -4
- package/Widgets/Widgets3D/LabelWidget.js +4 -3
- package/Widgets/Widgets3D/LineWidget.js +9 -5
- package/Widgets/Widgets3D/PaintWidget.js +13 -9
- package/Widgets/Widgets3D/PolyLineWidget.js +8 -4
- package/Widgets/Widgets3D/RectangleWidget.js +2 -3
- package/Widgets/Widgets3D/ResliceCursorWidget.js +12 -5
- package/Widgets/Widgets3D/SphereWidget.js +8 -3
- package/Widgets/Widgets3D/SplineWidget.js +16 -13
- package/package.json +1 -1
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
import { mat4, vec3 } from 'gl-matrix';
|
|
2
2
|
import { newInstance as newInstance$1, obj, get, getArray, setGet, vtkDebugMacro as vtkDebugMacro$1 } from '../../macros.js';
|
|
3
|
+
import { r as radiansFromDegrees } from '../../Common/Core/Math/index.js';
|
|
3
4
|
import vtkViewNode from '../SceneGraph/ViewNode.js';
|
|
4
5
|
import vtkWebGPUBindGroup from './BindGroup.js';
|
|
5
6
|
import vtkWebGPUFullScreenQuad from './FullScreenQuad.js';
|
|
7
|
+
import vtkWebGPUStorageBuffer from './StorageBuffer.js';
|
|
6
8
|
import vtkWebGPUUniformBuffer from './UniformBuffer.js';
|
|
7
9
|
import { registerOverride } from './ViewNodeFactory.js';
|
|
8
10
|
|
|
9
11
|
var vtkDebugMacro = vtkDebugMacro$1;
|
|
10
|
-
var clearFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4<f32> = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"; //
|
|
12
|
+
var clearFragTemplate = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::TCoord::Dec\n\n//VTK::RenderEncoder::Dec\n\n//VTK::IOStructs::Dec\n\n@fragment\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output: fragmentOutput;\n\n var computedColor: vec4<f32> = mapperUBO.BackgroundColor;\n\n //VTK::RenderEncoder::Impl\n return output;\n}\n"; // Light type index gives either 0, 1, or 2 which indicates what type of light there is.
|
|
13
|
+
// While technically, there are only spot and directional lights, within the CellArrayMapper
|
|
14
|
+
// there is a third, positional light. It is technically just a variant of a spot light with
|
|
15
|
+
// a cone angle of 90 or above, however certain calculations can be skipped if it is treated
|
|
16
|
+
// separately.
|
|
17
|
+
// The mappings are shown below:
|
|
18
|
+
// 0 -> positional light
|
|
19
|
+
// 1 -> directional light
|
|
20
|
+
// 2 -> spot light
|
|
21
|
+
|
|
22
|
+
function getLightTypeIndex(light) {
|
|
23
|
+
if (light.getPositional()) {
|
|
24
|
+
if (light.getConeAngle() >= 90) {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return 1;
|
|
32
|
+
} // ----------------------------------------------------------------------------
|
|
11
33
|
// vtkWebGPURenderer methods
|
|
12
34
|
// ----------------------------------------------------------------------------
|
|
13
35
|
|
|
14
36
|
/* eslint-disable no-bitwise */
|
|
15
37
|
|
|
38
|
+
|
|
16
39
|
function vtkWebGPURenderer(publicAPI, model) {
|
|
17
40
|
// Set our className
|
|
18
41
|
model.classHierarchy.push('vtkWebGPURenderer'); // Builds myself.
|
|
@@ -108,6 +131,7 @@ function vtkWebGPURenderer(publicAPI, model) {
|
|
|
108
131
|
model.UBO.setArray('SCVCMatrix', keyMats.scvc);
|
|
109
132
|
model.UBO.setArray('VCPCMatrix', keyMats.vcpc);
|
|
110
133
|
model.UBO.setArray('WCVCNormals', keyMats.normalMatrix);
|
|
134
|
+
model.UBO.setValue('LightCount', model.renderable.getLights().length);
|
|
111
135
|
var tsize = publicAPI.getYInvertedTiledSizeAndOrigin();
|
|
112
136
|
model.UBO.setArray('viewportSize', [tsize.usize, tsize.vsize]);
|
|
113
137
|
model.UBO.setValue('cameraParallel', model.camera.getParallelProjection());
|
|
@@ -118,6 +142,79 @@ function vtkWebGPURenderer(publicAPI, model) {
|
|
|
118
142
|
}
|
|
119
143
|
};
|
|
120
144
|
|
|
145
|
+
publicAPI.updateSSBO = function () {
|
|
146
|
+
var lights = model.renderable.getLights();
|
|
147
|
+
var keyMats = model.webgpuCamera.getKeyMatrices(publicAPI);
|
|
148
|
+
var lightTimeString = "".concat(model.renderable.getMTime());
|
|
149
|
+
|
|
150
|
+
for (var i = 0; i < lights.length; i++) {
|
|
151
|
+
lightTimeString += lights[i].getMTime();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (lightTimeString !== model.lightTimeString) {
|
|
155
|
+
var lightPosArray = new Float32Array(lights.length * 4);
|
|
156
|
+
var lightDirArray = new Float32Array(lights.length * 4);
|
|
157
|
+
var lightColorArray = new Float32Array(lights.length * 4);
|
|
158
|
+
var lightTypeArray = new Float32Array(lights.length * 4);
|
|
159
|
+
|
|
160
|
+
for (var _i = 0; _i < lights.length; _i++) {
|
|
161
|
+
var offset = _i * 4; // Position
|
|
162
|
+
|
|
163
|
+
var viewCoordinatePosition = lights[_i].getPosition();
|
|
164
|
+
|
|
165
|
+
vec3.transformMat4(viewCoordinatePosition, viewCoordinatePosition, keyMats.wcvc); // console.log(viewCoordinatePosition);
|
|
166
|
+
// viewCoordinatePosition
|
|
167
|
+
|
|
168
|
+
lightPosArray[offset] = viewCoordinatePosition[0];
|
|
169
|
+
lightPosArray[offset + 1] = viewCoordinatePosition[1];
|
|
170
|
+
lightPosArray[offset + 2] = viewCoordinatePosition[2];
|
|
171
|
+
lightPosArray[offset + 3] = 0; // Rotation (All are negative to correct for -Z being forward)
|
|
172
|
+
|
|
173
|
+
lightDirArray[offset] = -lights[_i].getDirection()[0];
|
|
174
|
+
lightDirArray[offset + 1] = -lights[_i].getDirection()[1];
|
|
175
|
+
lightDirArray[offset + 2] = -lights[_i].getDirection()[2];
|
|
176
|
+
lightDirArray[offset + 3] = 0; // Color
|
|
177
|
+
|
|
178
|
+
lightColorArray[offset] = lights[_i].getColor()[0];
|
|
179
|
+
lightColorArray[offset + 1] = lights[_i].getColor()[1];
|
|
180
|
+
lightColorArray[offset + 2] = lights[_i].getColor()[2];
|
|
181
|
+
lightColorArray[offset + 3] = lights[_i].getIntensity() * 5; // arbitrary multiplication to fix the dullness of low value PBR lights
|
|
182
|
+
// Type
|
|
183
|
+
|
|
184
|
+
lightTypeArray[offset] = getLightTypeIndex(lights[_i]); // Type
|
|
185
|
+
|
|
186
|
+
lightTypeArray[offset + 1] = Math.cos(radiansFromDegrees(lights[_i].getConeAngle())); // Inner Phi, should probably do some check on these to make sure they dont excede limits
|
|
187
|
+
|
|
188
|
+
lightTypeArray[offset + 2] = Math.cos(radiansFromDegrees(lights[_i].getConeAngle() + lights[_i].getConeFalloff())); // Outer Phi
|
|
189
|
+
|
|
190
|
+
lightTypeArray[offset + 3] = 0;
|
|
191
|
+
} // Im not sure how correct this is, but this is what the example does
|
|
192
|
+
// https://kitware.github.io/vtk-js/api/Rendering_WebGPU_VolumePassFSQ.html
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
model.SSBO.clearData();
|
|
196
|
+
model.SSBO.setNumberOfInstances(lights.length);
|
|
197
|
+
model.SSBO.addEntry('LightPos', 'vec4<f32>'); // Position
|
|
198
|
+
|
|
199
|
+
model.SSBO.addEntry('LightDir', 'vec4<f32>'); // Direction
|
|
200
|
+
|
|
201
|
+
model.SSBO.addEntry('LightColor', 'vec4<f32>'); // Color (r, g, b, intensity)
|
|
202
|
+
|
|
203
|
+
model.SSBO.addEntry('LightData', 'vec4<f32>'); // Other data (type, etc, etc, etc)
|
|
204
|
+
|
|
205
|
+
model.SSBO.setAllInstancesFromArray('LightPos', lightPosArray);
|
|
206
|
+
model.SSBO.setAllInstancesFromArray('LightDir', lightDirArray);
|
|
207
|
+
model.SSBO.setAllInstancesFromArray('LightColor', lightColorArray);
|
|
208
|
+
model.SSBO.setAllInstancesFromArray('LightData', lightTypeArray);
|
|
209
|
+
|
|
210
|
+
var device = model._parent.getDevice();
|
|
211
|
+
|
|
212
|
+
model.SSBO.send(device);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
model.lightTimeString = lightTimeString;
|
|
216
|
+
};
|
|
217
|
+
|
|
121
218
|
publicAPI.scissorAndViewport = function (encoder) {
|
|
122
219
|
var tsize = publicAPI.getYInvertedTiledSizeAndOrigin();
|
|
123
220
|
encoder.getHandle().setViewport(tsize.lowerLeftU, tsize.lowerLeftV, tsize.usize, tsize.vsize, 0.0, 1.0); // set scissor
|
|
@@ -134,6 +231,7 @@ function vtkWebGPURenderer(publicAPI, model) {
|
|
|
134
231
|
if (prepass) {
|
|
135
232
|
model.renderEncoder.begin(model._parent.getCommandEncoder());
|
|
136
233
|
publicAPI.updateUBO();
|
|
234
|
+
publicAPI.updateSSBO();
|
|
137
235
|
} else {
|
|
138
236
|
publicAPI.scissorAndViewport(model.renderEncoder);
|
|
139
237
|
publicAPI.clear();
|
|
@@ -284,7 +382,8 @@ function extend(publicAPI, model) {
|
|
|
284
382
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
285
383
|
Object.assign(model, DEFAULT_VALUES, initialValues); // Inheritance
|
|
286
384
|
|
|
287
|
-
vtkViewNode.extend(publicAPI, model, initialValues);
|
|
385
|
+
vtkViewNode.extend(publicAPI, model, initialValues); // UBO
|
|
386
|
+
|
|
288
387
|
model.UBO = vtkWebGPUUniformBuffer.newInstance({
|
|
289
388
|
label: 'rendererUBO'
|
|
290
389
|
});
|
|
@@ -295,11 +394,17 @@ function extend(publicAPI, model) {
|
|
|
295
394
|
model.UBO.addEntry('VCPCMatrix', 'mat4x4<f32>');
|
|
296
395
|
model.UBO.addEntry('WCVCNormals', 'mat4x4<f32>');
|
|
297
396
|
model.UBO.addEntry('viewportSize', 'vec2<f32>');
|
|
298
|
-
model.UBO.addEntry('
|
|
397
|
+
model.UBO.addEntry('LightCount', 'i32');
|
|
398
|
+
model.UBO.addEntry('cameraParallel', 'u32'); // SSBO (Light data)
|
|
399
|
+
|
|
400
|
+
model.SSBO = vtkWebGPUStorageBuffer.newInstance({
|
|
401
|
+
label: 'rendererLightSSBO'
|
|
402
|
+
});
|
|
403
|
+
model.lightTimeString = '';
|
|
299
404
|
model.bindGroup = vtkWebGPUBindGroup.newInstance({
|
|
300
405
|
label: 'rendererBG'
|
|
301
406
|
});
|
|
302
|
-
model.bindGroup.setBindables([model.UBO]);
|
|
407
|
+
model.bindGroup.setBindables([model.UBO, model.SSBO]);
|
|
303
408
|
model.tmpMat4 = mat4.identity(new Float64Array(16));
|
|
304
409
|
model.stabilizedTime = {};
|
|
305
410
|
obj(model.stabilizedTime, {
|
|
@@ -7,7 +7,7 @@ import { registerOverride } from './ViewNodeFactory.js';
|
|
|
7
7
|
|
|
8
8
|
var BufferUsage = vtkWebGPUBufferManager.BufferUsage;
|
|
9
9
|
var vtkErrorMacro = vtkErrorMacro$1;
|
|
10
|
-
var vtkWebGPUSphereMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.
|
|
10
|
+
var vtkWebGPUSphereMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var output : vertexOutput;\n\n var vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = length(offsetMC)*0.5;\n\n // make the triangle face the camera\n if (rendererUBO.cameraParallel == 0u)\n {\n var dir: vec3<f32> = normalize(-vertexVC.xyz);\n var base2: vec3<f32> = normalize(cross(dir,vec3<f32>(1.0,0.0,0.0)));\n var base1: vec3<f32> = cross(base2,dir);\n dir = vertexVC.xyz + offsetMC.x*base1 + offsetMC.y*base2;\n vertexVC = vec4<f32>(dir, 1.0);\n }\n else\n {\n // add in the offset\n var tmp2: vec2<f32> = vertexVC.xy + offsetMC;\n vertexVC = vec4<f32>(tmp2, vertexVC.zw);\n }\n\n output.vertexVC = vec4<f32>(vertexVC.xyz, 0.0);\n\n //VTK::Position::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
|
|
11
11
|
// vtkWebGPUSphereMapper methods
|
|
12
12
|
// ----------------------------------------------------------------------------
|
|
13
13
|
|
|
@@ -32,7 +32,7 @@ function vtkWebGPUSphereMapper(publicAPI, model) {
|
|
|
32
32
|
|
|
33
33
|
publicAPI.replaceShaderNormal = function (hash, pipeline, vertexInput) {
|
|
34
34
|
var vDesc = pipeline.getShaderDescription('vertex');
|
|
35
|
-
vDesc.addOutput('
|
|
35
|
+
if (!vDesc.hasOutput('vertexVC')) vDesc.addOutput('vec4<f32>', 'vertexVC');
|
|
36
36
|
vDesc.addOutput('vec3<f32>', 'centerVC');
|
|
37
37
|
vDesc.addOutput('f32', 'radiusVC');
|
|
38
38
|
var fDesc = pipeline.getShaderDescription('fragment');
|
|
@@ -26,7 +26,7 @@ var vtkErrorMacro = vtkErrorMacro$1; // Vertices
|
|
|
26
26
|
// 4: 011
|
|
27
27
|
// 5: 111
|
|
28
28
|
|
|
29
|
-
var vtkWebGPUStickMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array<vec3<f32>, 12> = array<vec3<f32>, 12>(\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(-1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n vec3<f32>(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.
|
|
29
|
+
var vtkWebGPUStickMapperVS = "\n//VTK::Renderer::Dec\n\n//VTK::Mapper::Dec\n\n//VTK::Color::Dec\n\n//VTK::IOStructs::Dec\n\n@vertex\nfn main(\n//VTK::IOStructs::Input\n)\n//VTK::IOStructs::Output\n{\n var offsetsArray: array<vec3<f32>, 12> = array<vec3<f32>, 12>(\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, -1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(-1.0, -1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n\n vec3<f32>(-1.0, -1.0, 1.0),\n vec3<f32>(1.0, 1.0, 1.0),\n vec3<f32>(-1.0, 1.0, 1.0)\n );\n\n var output : vertexOutput;\n\n var vertexVC: vec4<f32> = rendererUBO.SCVCMatrix * mapperUBO.BCSCMatrix * vec4<f32>(vertexBC.xyz, 1.0);\n\n //VTK::Color::Impl\n\n // compute the projected vertex position\n output.centerVC = vertexVC.xyz;\n output.radiusVC = radiusMC;\n output.lengthVC = length(orientMC);\n output.orientVC = (rendererUBO.WCVCNormals * vec4<f32>(normalize(orientMC), 0.0)).xyz;\n\n // make sure it is pointing out of the screen\n if (output.orientVC.z < 0.0)\n {\n output.orientVC = -output.orientVC;\n }\n\n // make the basis\n var xbase: vec3<f32>;\n var ybase: vec3<f32>;\n var dir: vec3<f32> = vec3<f32>(0.0,0.0,1.0);\n if (rendererUBO.cameraParallel == 0u)\n {\n dir = normalize(-vertexVC.xyz);\n }\n if (abs(dot(dir,output.orientVC)) == 1.0)\n {\n xbase = normalize(cross(vec3<f32>(0.0,1.0,0.0),output.orientVC));\n ybase = cross(xbase,output.orientVC);\n }\n else\n {\n xbase = normalize(cross(output.orientVC,dir));\n ybase = cross(output.orientVC,xbase);\n }\n\n\n var vertIdx: u32 = input.vertexIndex % 12u;\n var offsets: vec3<f32> = offsetsArray[vertIdx];\n\n vertexVC = vec4<f32>(vertexVC.xyz +\n output.radiusVC * offsets.x * xbase +\n output.radiusVC * offsets.y * ybase +\n 0.5 * output.lengthVC * offsets.z * output.orientVC, 1.0);\n\n output.vertexVC = vertexVC;\n\n //VTK::Position::Impl\n\n return output;\n}\n"; // ----------------------------------------------------------------------------
|
|
30
30
|
// vtkWebGPUStickMapper methods
|
|
31
31
|
// ----------------------------------------------------------------------------
|
|
32
32
|
|
|
@@ -51,7 +51,7 @@ function vtkWebGPUStickMapper(publicAPI, model) {
|
|
|
51
51
|
|
|
52
52
|
publicAPI.replaceShaderNormal = function (hash, pipeline, vertexInput) {
|
|
53
53
|
var vDesc = pipeline.getShaderDescription('vertex');
|
|
54
|
-
vDesc.addOutput('vec4<f32>', 'vertexVC');
|
|
54
|
+
if (!vDesc.hasOutput('vertexVC')) vDesc.addOutput('vec4<f32>', 'vertexVC');
|
|
55
55
|
vDesc.addOutput('vec3<f32>', 'centerVC');
|
|
56
56
|
vDesc.addOutput('vec3<f32>', 'orientVC');
|
|
57
57
|
vDesc.addOutput('f32', 'radiusVC');
|
|
@@ -184,6 +184,14 @@ function vtkWebGPUTexture(publicAPI, model) {
|
|
|
184
184
|
return tDetails.numComponents;
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
+
publicAPI.getDimensionality = function () {
|
|
188
|
+
var dims = 0;
|
|
189
|
+
if (model.width > 1) dims++;
|
|
190
|
+
if (model.height > 1) dims++;
|
|
191
|
+
if (model.depth > 1) dims++;
|
|
192
|
+
return dims;
|
|
193
|
+
};
|
|
194
|
+
|
|
187
195
|
publicAPI.resizeToMatch = function (tex) {
|
|
188
196
|
if (tex.getWidth() !== model.width || tex.getHeight() !== model.height || tex.getDepth() !== model.depth) {
|
|
189
197
|
model.width = tex.getWidth();
|
|
@@ -325,7 +325,7 @@ function getByteStrideFromBufferFormat(format) {
|
|
|
325
325
|
var numComp = 1;
|
|
326
326
|
|
|
327
327
|
if (format[format.length - 2] === 'x') {
|
|
328
|
-
numComp = format[format.length - 1];
|
|
328
|
+
numComp = Number(format[format.length - 1]);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
var sizeStart = numComp === 1 ? format.length - 1 : format.length - 3; // options are 8, 16, 32 resulting in 8, 6, 2 as the last char
|
|
@@ -350,7 +350,7 @@ function getNumberOfComponentsFromBufferFormat(format) {
|
|
|
350
350
|
var numComp = 1;
|
|
351
351
|
|
|
352
352
|
if (format[format.length - 2] === 'x') {
|
|
353
|
-
numComp = format[format.length - 1];
|
|
353
|
+
numComp = Number(format[format.length - 1]);
|
|
354
354
|
}
|
|
355
355
|
|
|
356
356
|
return numComp;
|
|
@@ -421,7 +421,7 @@ function getByteStrideFromShaderFormat(format) {
|
|
|
421
421
|
var numComp = 1;
|
|
422
422
|
|
|
423
423
|
if (format.substring(0, 3) === 'vec') {
|
|
424
|
-
numComp = format[3];
|
|
424
|
+
numComp = Number(format[3]);
|
|
425
425
|
} else if (format.substring(0, 3) === 'mat') {
|
|
426
426
|
numComp = format[3] * format[5];
|
|
427
427
|
}
|
|
@@ -187,19 +187,19 @@ function vtkAbstractWidgetFactory(publicAPI, model) {
|
|
|
187
187
|
var unsubscribe = NoOp;
|
|
188
188
|
publicAPI.delete = macro.chain(publicAPI.delete, function () {
|
|
189
189
|
return unsubscribe();
|
|
190
|
-
});
|
|
190
|
+
});
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
}, 0);
|
|
192
|
+
if (model.widgetState) {
|
|
193
|
+
unsubscribe = model.widgetState.onModified(function () {
|
|
194
|
+
return publicAPI.invokeWidgetChange(model.widgetState);
|
|
195
|
+
}).unsubscribe;
|
|
196
|
+
}
|
|
199
197
|
} // ----------------------------------------------------------------------------
|
|
200
198
|
|
|
201
199
|
|
|
202
200
|
function extend(publicAPI, model) {
|
|
201
|
+
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
202
|
+
Object.assign(model, initialValues);
|
|
203
203
|
macro.obj(publicAPI, model);
|
|
204
204
|
macro.get(publicAPI, model, ['widgetState']);
|
|
205
205
|
macro.event(publicAPI, model, 'WidgetChange');
|
|
@@ -22,8 +22,6 @@ function vtkAngleWidget(publicAPI, model) {
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
|
|
25
|
-
model.behavior = widgetBehavior;
|
|
26
|
-
model.widgetState = generateState();
|
|
27
25
|
|
|
28
26
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
29
27
|
switch (viewType) {
|
|
@@ -87,12 +85,18 @@ function vtkAngleWidget(publicAPI, model) {
|
|
|
87
85
|
} // ----------------------------------------------------------------------------
|
|
88
86
|
|
|
89
87
|
|
|
90
|
-
var
|
|
88
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
89
|
+
return _objectSpread({
|
|
90
|
+
// manipulator: null,
|
|
91
|
+
behavior: widgetBehavior,
|
|
92
|
+
widgetState: generateState()
|
|
93
|
+
}, initialValues);
|
|
91
94
|
}; // ----------------------------------------------------------------------------
|
|
92
95
|
|
|
96
|
+
|
|
93
97
|
function extend(publicAPI, model) {
|
|
94
98
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
95
|
-
Object.assign(model,
|
|
99
|
+
Object.assign(model, defaultValues(initialValues));
|
|
96
100
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
97
101
|
macro.setGet(publicAPI, model, ['manipulator']);
|
|
98
102
|
vtkAngleWidget(publicAPI, model);
|
|
@@ -22,8 +22,6 @@ function vtkDistanceWidget(publicAPI, model) {
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
|
|
25
|
-
model.behavior = widgetBehavior;
|
|
26
|
-
model.widgetState = generateState();
|
|
27
25
|
|
|
28
26
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
29
27
|
switch (viewType) {
|
|
@@ -82,12 +80,18 @@ function vtkDistanceWidget(publicAPI, model) {
|
|
|
82
80
|
} // ----------------------------------------------------------------------------
|
|
83
81
|
|
|
84
82
|
|
|
85
|
-
var
|
|
83
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
84
|
+
return _objectSpread({
|
|
85
|
+
// manipulator: null,
|
|
86
|
+
behavior: widgetBehavior,
|
|
87
|
+
widgetState: generateState()
|
|
88
|
+
}, initialValues);
|
|
86
89
|
}; // ----------------------------------------------------------------------------
|
|
87
90
|
|
|
91
|
+
|
|
88
92
|
function extend(publicAPI, model) {
|
|
89
93
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
90
|
-
Object.assign(model,
|
|
94
|
+
Object.assign(model, defaultValues(initialValues));
|
|
91
95
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
92
96
|
macro.setGet(publicAPI, model, ['manipulator']);
|
|
93
97
|
vtkDistanceWidget(publicAPI, model);
|
|
@@ -21,7 +21,6 @@ function vtkEllipseWidget(publicAPI, model) {
|
|
|
21
21
|
model.classHierarchy.push('vtkEllipseWidget'); // --- Widget Requirement ---------------------------------------------------
|
|
22
22
|
|
|
23
23
|
model.methodsToLink = [].concat(_toConsumableArray(model.methodsToLink), ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'drawBorder', 'drawFace', 'opacity']);
|
|
24
|
-
model.behavior = widgetBehavior;
|
|
25
24
|
|
|
26
25
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
27
26
|
switch (viewType) {
|
|
@@ -49,7 +48,6 @@ function vtkEllipseWidget(publicAPI, model) {
|
|
|
49
48
|
// --------------------------------------------------------------------------
|
|
50
49
|
|
|
51
50
|
|
|
52
|
-
model.widgetState = generateState();
|
|
53
51
|
publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
|
|
54
52
|
useCameraNormal: true
|
|
55
53
|
}));
|
|
@@ -60,6 +58,8 @@ function defaultValues(initialValues) {
|
|
|
60
58
|
var _None;
|
|
61
59
|
|
|
62
60
|
return _objectSpread({
|
|
61
|
+
behavior: widgetBehavior,
|
|
62
|
+
widgetState: generateState(),
|
|
63
63
|
modifierBehavior: {
|
|
64
64
|
None: (_None = {}, _defineProperty(_None, BehaviorCategory.PLACEMENT, ShapeBehavior[BehaviorCategory.PLACEMENT].CLICK_AND_DRAG), _defineProperty(_None, BehaviorCategory.POINTS, ShapeBehavior[BehaviorCategory.POINTS].CENTER_TO_CORNER), _defineProperty(_None, BehaviorCategory.RATIO, ShapeBehavior[BehaviorCategory.RATIO].FREE), _None),
|
|
65
65
|
Shift: _defineProperty({}, BehaviorCategory.RATIO, ShapeBehavior[BehaviorCategory.RATIO].FIXED),
|
|
@@ -100,8 +100,6 @@ function vtkImageCroppingWidget(publicAPI, model) {
|
|
|
100
100
|
}
|
|
101
101
|
}); // --- Widget Requirement ---------------------------------------------------
|
|
102
102
|
|
|
103
|
-
model.behavior = widgetBehavior;
|
|
104
|
-
model.widgetState = build();
|
|
105
103
|
model.methodsToLink = ['scaleInPixels']; // Given a view type (geometry, slice, volume), return a description
|
|
106
104
|
// of what representations to create and what widget state to pass
|
|
107
105
|
// to the respective representations.
|
|
@@ -162,14 +160,20 @@ function vtkImageCroppingWidget(publicAPI, model) {
|
|
|
162
160
|
} // ----------------------------------------------------------------------------
|
|
163
161
|
|
|
164
162
|
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
164
|
+
return _objectSpread({
|
|
165
|
+
// cornerManipulator: null,
|
|
166
|
+
// edgeManipulator: null,
|
|
167
|
+
// faceManipulator: null,
|
|
168
|
+
behavior: widgetBehavior,
|
|
169
|
+
widgetState: build()
|
|
170
|
+
}, initialValues);
|
|
168
171
|
}; // ----------------------------------------------------------------------------
|
|
169
172
|
|
|
173
|
+
|
|
170
174
|
function extend(publicAPI, model) {
|
|
171
175
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
172
|
-
Object.assign(model,
|
|
176
|
+
Object.assign(model, defaultValues(initialValues));
|
|
173
177
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
174
178
|
macro.setGet(publicAPI, model, ['cornerManipulator', 'edgeManipulator', 'faceManipulator']);
|
|
175
179
|
vtkImageCroppingWidget(publicAPI, model);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
3
|
import macro from '../../macros.js';
|
|
3
4
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
@@ -7,6 +8,9 @@ import vtkTrackballManipulator from '../Manipulators/TrackballManipulator.js';
|
|
|
7
8
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
8
9
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
9
10
|
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
10
14
|
// Widget linked to a view
|
|
11
15
|
// ----------------------------------------------------------------------------
|
|
12
16
|
|
|
@@ -143,8 +147,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
143
147
|
function vtkImplicitPlaneWidget(publicAPI, model) {
|
|
144
148
|
model.classHierarchy.push('vtkPlaneWidget'); // --- Widget Requirement ---------------------------------------------------
|
|
145
149
|
|
|
146
|
-
model.widgetState = vtkImplicitPlaneRepresentation.generateState();
|
|
147
|
-
model.behavior = widgetBehavior;
|
|
148
150
|
model.methodsToLink = ['representationStyle', 'sphereResolution', 'handleSizeRatio', 'axisScale', 'normalVisible', 'originVisible', 'planeVisible', 'outlineVisible'];
|
|
149
151
|
|
|
150
152
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
@@ -162,11 +164,17 @@ function vtkImplicitPlaneWidget(publicAPI, model) {
|
|
|
162
164
|
} // ----------------------------------------------------------------------------
|
|
163
165
|
|
|
164
166
|
|
|
165
|
-
var
|
|
167
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
168
|
+
return _objectSpread({
|
|
169
|
+
behavior: widgetBehavior,
|
|
170
|
+
widgetState: vtkImplicitPlaneRepresentation.generateState()
|
|
171
|
+
}, initialValues);
|
|
172
|
+
}; // ----------------------------------------------------------------------------
|
|
173
|
+
|
|
166
174
|
|
|
167
175
|
function extend(publicAPI, model) {
|
|
168
176
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
169
|
-
Object.assign(model,
|
|
177
|
+
Object.assign(model, defaultValues(initialValues));
|
|
170
178
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
171
179
|
vtkImplicitPlaneWidget(publicAPI, model);
|
|
172
180
|
} // ----------------------------------------------------------------------------
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import macro from '../../macros.js';
|
|
2
3
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
3
4
|
import vtkConvexFaceContextRepresentation from '../Representations/ConvexFaceContextRepresentation.js';
|
|
@@ -6,6 +7,9 @@ import { generateState, INITIAL_POINTS } from './InteractiveOrientationWidget/st
|
|
|
6
7
|
import { Behavior } from '../Representations/WidgetRepresentation/Constants.js';
|
|
7
8
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
8
9
|
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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
13
|
// Factory
|
|
10
14
|
// ----------------------------------------------------------------------------
|
|
11
15
|
|
|
@@ -13,8 +17,6 @@ function vtkInteractiveOrientationWidget(publicAPI, model) {
|
|
|
13
17
|
model.classHierarchy.push('vtkInteractiveOrientationWidget'); // --- Widget Requirement ---------------------------------------------------
|
|
14
18
|
|
|
15
19
|
model.methodsToLink = ['closePolyLine', 'activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale'];
|
|
16
|
-
model.behavior = widgetBehavior;
|
|
17
|
-
model.widgetState = generateState();
|
|
18
20
|
|
|
19
21
|
publicAPI.setBounds = function (bounds) {
|
|
20
22
|
var handles = model.widgetState.getStatesWithLabel('handles');
|
|
@@ -107,11 +109,17 @@ function vtkInteractiveOrientationWidget(publicAPI, model) {
|
|
|
107
109
|
} // ----------------------------------------------------------------------------
|
|
108
110
|
|
|
109
111
|
|
|
110
|
-
var
|
|
112
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
113
|
+
return _objectSpread({
|
|
114
|
+
behavior: widgetBehavior,
|
|
115
|
+
widgetState: generateState()
|
|
116
|
+
}, initialValues);
|
|
117
|
+
}; // ----------------------------------------------------------------------------
|
|
118
|
+
|
|
111
119
|
|
|
112
120
|
function extend(publicAPI, model) {
|
|
113
121
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
114
|
-
Object.assign(model,
|
|
122
|
+
Object.assign(model, defaultValues(initialValues));
|
|
115
123
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
116
124
|
vtkInteractiveOrientationWidget(publicAPI, model);
|
|
117
125
|
} // ----------------------------------------------------------------------------
|
|
@@ -22,8 +22,6 @@ function vtkLabelWidget(publicAPI, model) {
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
model.methodsToLink = ['textProps', 'fontProperties', 'strokeFontProperties', 'scaleInPixels'];
|
|
25
|
-
model.behavior = widgetBehavior;
|
|
26
|
-
model.widgetState = generateState();
|
|
27
25
|
|
|
28
26
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
29
27
|
switch (viewType) {
|
|
@@ -72,7 +70,10 @@ function vtkLabelWidget(publicAPI, model) {
|
|
|
72
70
|
|
|
73
71
|
|
|
74
72
|
function defaultValues(initialValues) {
|
|
75
|
-
return _objectSpread({
|
|
73
|
+
return _objectSpread({
|
|
74
|
+
behavior: widgetBehavior,
|
|
75
|
+
widgetState: generateState()
|
|
76
|
+
}, initialValues);
|
|
76
77
|
} // ----------------------------------------------------------------------------
|
|
77
78
|
|
|
78
79
|
|
|
@@ -21,10 +21,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
21
21
|
function vtkLineWidget(publicAPI, model) {
|
|
22
22
|
model.classHierarchy.push('vtkLineWidget');
|
|
23
23
|
|
|
24
|
-
var superClass = _objectSpread({}, publicAPI);
|
|
24
|
+
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
25
25
|
|
|
26
|
-
model.widgetState = generateState();
|
|
27
|
-
model.behavior = widgetBehavior; // --- Widget Requirement ---------------------------------------------------
|
|
28
26
|
|
|
29
27
|
model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
|
|
30
28
|
|
|
@@ -165,12 +163,18 @@ function vtkLineWidget(publicAPI, model) {
|
|
|
165
163
|
} // ----------------------------------------------------------------------------
|
|
166
164
|
|
|
167
165
|
|
|
168
|
-
var
|
|
166
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
167
|
+
return _objectSpread({
|
|
168
|
+
// manipulator: null,
|
|
169
|
+
behavior: widgetBehavior,
|
|
170
|
+
widgetState: generateState()
|
|
171
|
+
}, initialValues);
|
|
169
172
|
}; // ----------------------------------------------------------------------------
|
|
170
173
|
|
|
174
|
+
|
|
171
175
|
function extend(publicAPI, model) {
|
|
172
176
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
173
|
-
Object.assign(model,
|
|
177
|
+
Object.assign(model, defaultValues(initialValues));
|
|
174
178
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
175
179
|
macro.setGet(publicAPI, model, ['manipulator']);
|
|
176
180
|
vtkLineWidget(publicAPI, model);
|
|
@@ -20,9 +20,6 @@ function vtkPaintWidget(publicAPI, model) {
|
|
|
20
20
|
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
model.behavior = widgetBehavior;
|
|
24
|
-
model.widgetState = generateState(model.radius);
|
|
25
|
-
|
|
26
23
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
27
24
|
switch (viewType) {
|
|
28
25
|
case ViewTypes.DEFAULT:
|
|
@@ -67,16 +64,23 @@ function vtkPaintWidget(publicAPI, model) {
|
|
|
67
64
|
} // ----------------------------------------------------------------------------
|
|
68
65
|
|
|
69
66
|
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
68
|
+
var _initialValues$radius;
|
|
69
|
+
|
|
70
|
+
return _objectSpread({
|
|
71
|
+
// manipulator: null,
|
|
72
|
+
radius: 1,
|
|
73
|
+
painting: false,
|
|
74
|
+
color: [1],
|
|
75
|
+
behavior: widgetBehavior,
|
|
76
|
+
widgetState: generateState((_initialValues$radius = initialValues === null || initialValues === void 0 ? void 0 : initialValues.radius) !== null && _initialValues$radius !== void 0 ? _initialValues$radius : 1)
|
|
77
|
+
}, initialValues);
|
|
75
78
|
}; // ----------------------------------------------------------------------------
|
|
76
79
|
|
|
80
|
+
|
|
77
81
|
function extend(publicAPI, model) {
|
|
78
82
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
79
|
-
Object.assign(model,
|
|
83
|
+
Object.assign(model, defaultValues(initialValues));
|
|
80
84
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
81
85
|
macro.get(publicAPI, model, ['painting']);
|
|
82
86
|
macro.setGet(publicAPI, model, ['manipulator', 'radius', 'color']);
|
|
@@ -22,8 +22,6 @@ function vtkPolyLineWidget(publicAPI, model) {
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
model.methodsToLink = ['activeColor', 'activeScaleFactor', 'closePolyLine', 'defaultScale', 'glyphResolution', 'lineThickness', 'useActiveColor', 'scaleInPixels'];
|
|
25
|
-
model.behavior = widgetBehavior;
|
|
26
|
-
model.widgetState = generateState();
|
|
27
25
|
|
|
28
26
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
29
27
|
switch (viewType) {
|
|
@@ -78,12 +76,18 @@ function vtkPolyLineWidget(publicAPI, model) {
|
|
|
78
76
|
} // ----------------------------------------------------------------------------
|
|
79
77
|
|
|
80
78
|
|
|
81
|
-
var
|
|
79
|
+
var defaultValues = function defaultValues(initialValues) {
|
|
80
|
+
return _objectSpread({
|
|
81
|
+
manipulator: null,
|
|
82
|
+
behavior: widgetBehavior,
|
|
83
|
+
widgetState: generateState()
|
|
84
|
+
}, initialValues);
|
|
82
85
|
}; // ----------------------------------------------------------------------------
|
|
83
86
|
|
|
87
|
+
|
|
84
88
|
function extend(publicAPI, model) {
|
|
85
89
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
86
|
-
Object.assign(model,
|
|
90
|
+
Object.assign(model, defaultValues(initialValues));
|
|
87
91
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
88
92
|
macro.setGet(publicAPI, model, ['manipulator']);
|
|
89
93
|
vtkPolyLineWidget(publicAPI, model);
|