@cornerstonejs/tools 1.25.0 → 1.26.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/dist/cjs/drawingSvg/drawRedactionRect.d.ts +1 -0
- package/dist/cjs/drawingSvg/drawRedactionRect.js +44 -0
- package/dist/cjs/drawingSvg/drawRedactionRect.js.map +1 -0
- package/dist/cjs/drawingSvg/index.d.ts +2 -1
- package/dist/cjs/drawingSvg/index.js +3 -1
- package/dist/cjs/drawingSvg/index.js.map +1 -1
- package/dist/cjs/eventListeners/touch/touchStartListener.js +0 -8
- package/dist/cjs/eventListeners/touch/touchStartListener.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tools/ZoomTool.js +2 -5
- package/dist/cjs/tools/ZoomTool.js.map +1 -1
- package/dist/cjs/tools/annotation/VideoRedactionTool.d.ts +46 -0
- package/dist/cjs/tools/annotation/VideoRedactionTool.js +492 -0
- package/dist/cjs/tools/annotation/VideoRedactionTool.js.map +1 -0
- package/dist/cjs/tools/base/AnnotationDisplayTool.d.ts +1 -1
- package/dist/cjs/tools/base/AnnotationDisplayTool.js +2 -1
- package/dist/cjs/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/base/BaseTool.js +3 -0
- package/dist/cjs/tools/base/BaseTool.js.map +1 -1
- package/dist/cjs/types/AnnotationTypes.d.ts +1 -1
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +20 -0
- package/dist/cjs/utilities/planar/filterAnnotationsForDisplay.js +6 -0
- package/dist/cjs/utilities/planar/filterAnnotationsForDisplay.js.map +1 -1
- package/dist/cjs/utilities/scroll.d.ts +1 -1
- package/dist/cjs/utilities/scroll.js +3 -0
- package/dist/cjs/utilities/scroll.js.map +1 -1
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.d.ts +1 -1
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.js.map +1 -1
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithToolEnabled.d.ts +1 -1
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithToolEnabled.js.map +1 -1
- package/dist/esm/drawingSvg/drawRedactionRect.d.ts +1 -0
- package/dist/esm/drawingSvg/drawRedactionRect.js +38 -0
- package/dist/esm/drawingSvg/drawRedactionRect.js.map +1 -0
- package/dist/esm/drawingSvg/index.d.ts +2 -1
- package/dist/esm/drawingSvg/index.js +2 -1
- package/dist/esm/drawingSvg/index.js.map +1 -1
- package/dist/esm/eventListeners/touch/touchStartListener.js +0 -8
- package/dist/esm/eventListeners/touch/touchStartListener.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tools/ZoomTool.js +2 -5
- package/dist/esm/tools/ZoomTool.js.map +1 -1
- package/dist/esm/tools/annotation/VideoRedactionTool.d.ts +46 -0
- package/dist/esm/tools/annotation/VideoRedactionTool.js +464 -0
- package/dist/esm/tools/annotation/VideoRedactionTool.js.map +1 -0
- package/dist/esm/tools/base/AnnotationDisplayTool.d.ts +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +3 -2
- package/dist/esm/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/base/BaseTool.js +4 -1
- package/dist/esm/tools/base/BaseTool.js.map +1 -1
- package/dist/esm/types/AnnotationTypes.d.ts +1 -1
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +20 -0
- package/dist/esm/utilities/planar/filterAnnotationsForDisplay.js +7 -1
- package/dist/esm/utilities/planar/filterAnnotationsForDisplay.js.map +1 -1
- package/dist/esm/utilities/scroll.d.ts +1 -1
- package/dist/esm/utilities/scroll.js +4 -1
- package/dist/esm/utilities/scroll.js.map +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.js.map +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithToolEnabled.d.ts +1 -1
- package/dist/esm/utilities/viewportFilters/filterViewportsWithToolEnabled.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/drawingSvg/drawRedactionRect.ts +62 -0
- package/src/drawingSvg/index.ts +2 -0
- package/src/eventListeners/touch/touchStartListener.ts +3 -10
- package/src/index.ts +3 -0
- package/src/tools/ZoomTool.ts +2 -10
- package/src/tools/annotation/VideoRedactionTool.ts +788 -0
- package/src/tools/base/AnnotationDisplayTool.ts +6 -3
- package/src/tools/base/AnnotationTool.ts +1 -1
- package/src/tools/base/BaseTool.ts +3 -0
- package/src/types/AnnotationTypes.ts +1 -1
- package/src/types/ToolSpecificAnnotationTypes.ts +21 -0
- package/src/utilities/planar/filterAnnotationsForDisplay.ts +7 -0
- package/src/utilities/scroll.ts +4 -1
- package/src/utilities/viewportFilters/filterViewportsWithFrameOfReferenceUID.ts +1 -1
- package/src/utilities/viewportFilters/filterViewportsWithToolEnabled.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.
|
|
32
|
+
"@cornerstonejs/core": "^1.26.0",
|
|
33
33
|
"lodash.clonedeep": "4.5.0",
|
|
34
34
|
"lodash.get": "^4.4.2"
|
|
35
35
|
},
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "df9b69e21ab5dd9ccb33eaca7508abcb9f031e00"
|
|
56
56
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import _getHash from './_getHash';
|
|
2
|
+
import _setAttributesIfNecessary from './setAttributesIfNecessary';
|
|
3
|
+
import _setNewAttributesIfValid from './setNewAttributesIfValid';
|
|
4
|
+
|
|
5
|
+
// <rect x="120" y="100" width="100" height="100" />
|
|
6
|
+
export default function drawRedactionRect(
|
|
7
|
+
svgDrawingHelper: any,
|
|
8
|
+
annotationUID: string,
|
|
9
|
+
rectangleUID: string,
|
|
10
|
+
start: any,
|
|
11
|
+
end: any,
|
|
12
|
+
options = {}
|
|
13
|
+
): void {
|
|
14
|
+
const {
|
|
15
|
+
color,
|
|
16
|
+
width: _width,
|
|
17
|
+
lineWidth,
|
|
18
|
+
lineDash,
|
|
19
|
+
} = Object.assign(
|
|
20
|
+
{
|
|
21
|
+
color: 'dodgerblue',
|
|
22
|
+
width: '2',
|
|
23
|
+
lineWidth: undefined,
|
|
24
|
+
lineDash: undefined,
|
|
25
|
+
},
|
|
26
|
+
options
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// for supporting both lineWidth and width options
|
|
30
|
+
const strokeWidth = lineWidth || _width;
|
|
31
|
+
|
|
32
|
+
const svgns = 'http://www.w3.org/2000/svg';
|
|
33
|
+
const svgNodeHash = _getHash(annotationUID, 'rect', rectangleUID);
|
|
34
|
+
const existingRect = svgDrawingHelper.getSvgNode(svgNodeHash);
|
|
35
|
+
|
|
36
|
+
const tlhc = [Math.min(start[0], end[0]), Math.min(start[1], end[1])];
|
|
37
|
+
const width = Math.abs(start[0] - end[0]);
|
|
38
|
+
const height = Math.abs(start[1] - end[1]);
|
|
39
|
+
|
|
40
|
+
const attributes = {
|
|
41
|
+
x: `${tlhc[0]}`,
|
|
42
|
+
y: `${tlhc[1]}`,
|
|
43
|
+
width: `${width}`,
|
|
44
|
+
height: `${height}`,
|
|
45
|
+
stroke: color,
|
|
46
|
+
fill: 'black',
|
|
47
|
+
'stroke-width': strokeWidth,
|
|
48
|
+
'stroke-dasharray': lineDash,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (existingRect) {
|
|
52
|
+
_setAttributesIfNecessary(attributes, existingRect);
|
|
53
|
+
|
|
54
|
+
svgDrawingHelper.setNodeTouched(svgNodeHash);
|
|
55
|
+
} else {
|
|
56
|
+
const svgRectElement = document.createElementNS(svgns, 'rect');
|
|
57
|
+
|
|
58
|
+
_setNewAttributesIfValid(attributes, svgRectElement);
|
|
59
|
+
|
|
60
|
+
svgDrawingHelper.appendNode(svgRectElement, svgNodeHash);
|
|
61
|
+
}
|
|
62
|
+
}
|
package/src/drawingSvg/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import drawLinkedTextBox from './drawLinkedTextBox';
|
|
|
8
8
|
import drawRect from './drawRect';
|
|
9
9
|
import drawTextBox from './drawTextBox';
|
|
10
10
|
import drawArrow from './drawArrow';
|
|
11
|
+
import drawRedactionRect from './drawRedactionRect';
|
|
11
12
|
import setAttributesIfNecessary from './setAttributesIfNecessary';
|
|
12
13
|
import setNewAttributesIfValid from './setNewAttributesIfValid';
|
|
13
14
|
|
|
@@ -22,6 +23,7 @@ export {
|
|
|
22
23
|
drawRect,
|
|
23
24
|
drawTextBox,
|
|
24
25
|
drawArrow,
|
|
26
|
+
drawRedactionRect,
|
|
25
27
|
setAttributesIfNecessary,
|
|
26
28
|
setNewAttributesIfValid,
|
|
27
29
|
};
|
|
@@ -28,7 +28,7 @@ const {
|
|
|
28
28
|
TOUCH_SWIPE,
|
|
29
29
|
} = Events;
|
|
30
30
|
|
|
31
|
-
interface
|
|
31
|
+
interface ITouchTapListenerState {
|
|
32
32
|
element: HTMLDivElement;
|
|
33
33
|
renderingEngineId: string;
|
|
34
34
|
viewportId: string;
|
|
@@ -110,7 +110,7 @@ const defaultState: ITouchStartListenerState = {
|
|
|
110
110
|
// as pen, left/right handed, index finger vs thumb, etc. These current values
|
|
111
111
|
// assume thumb usage for single finger and index/middle finger for two finger
|
|
112
112
|
// gestures in an attempt to cover the 90% use case.
|
|
113
|
-
const defaultTapState:
|
|
113
|
+
const defaultTapState: ITouchTapListenerState = {
|
|
114
114
|
renderingEngineId: undefined,
|
|
115
115
|
viewportId: undefined,
|
|
116
116
|
element: null,
|
|
@@ -127,18 +127,11 @@ const defaultTapState: ITouchTapListnenerState = {
|
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
let state: ITouchStartListenerState = JSON.parse(JSON.stringify(defaultState));
|
|
130
|
-
let tapState:
|
|
130
|
+
let tapState: ITouchTapListenerState = JSON.parse(
|
|
131
131
|
JSON.stringify(defaultTapState)
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
function triggerEventCallback(ele, name, eventDetail) {
|
|
135
|
-
if (runtimeSettings.get('debug')) {
|
|
136
|
-
if (name === 'CORNERSTONE_TOOLS_TOUCH_DRAG') {
|
|
137
|
-
console.debug(name);
|
|
138
|
-
} else {
|
|
139
|
-
console.debug(name, eventDetail);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
135
|
return triggerEvent(ele, name, eventDetail);
|
|
143
136
|
}
|
|
144
137
|
|
package/src/index.ts
CHANGED
package/src/tools/ZoomTool.ts
CHANGED
|
@@ -145,10 +145,10 @@ class ZoomTool extends BaseTool {
|
|
|
145
145
|
const size = [element.clientWidth, element.clientHeight];
|
|
146
146
|
const { parallelScale, focalPoint, position } = camera;
|
|
147
147
|
|
|
148
|
-
const zoomScale =
|
|
148
|
+
const zoomScale = 5 / size[1];
|
|
149
149
|
const k = deltaY * zoomScale * (this.configuration.invert ? -1 : 1);
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
const parallelScaleToSet = (1.0 - k) * parallelScale;
|
|
152
152
|
|
|
153
153
|
let focalPointToSet = focalPoint;
|
|
154
154
|
let positionToSet = position;
|
|
@@ -163,14 +163,6 @@ class ZoomTool extends BaseTool {
|
|
|
163
163
|
focalPoint,
|
|
164
164
|
this.initialMousePosWorld
|
|
165
165
|
);
|
|
166
|
-
// const initialYDistanceBetweenInitialAndFocalPoint;
|
|
167
|
-
|
|
168
|
-
// we need to move in the direction of the vector between the focal point
|
|
169
|
-
// and the initial mouse position by some amount until ultimately we
|
|
170
|
-
// reach the mouse position at the focal point
|
|
171
|
-
const zoomScale = 5 / size[1];
|
|
172
|
-
const k = deltaY * zoomScale * (this.configuration.invert ? -1 : 1);
|
|
173
|
-
parallelScaleToSet = (1.0 - k) * parallelScale;
|
|
174
166
|
|
|
175
167
|
positionToSet = vec3.scaleAndAdd(
|
|
176
168
|
vec3.create(),
|