@cornerstonejs/tools 0.13.0 → 0.14.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/enums/ToolBindings.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tools/MagnifyTool.d.ts +24 -0
- package/dist/cjs/tools/MagnifyTool.js +169 -0
- package/dist/cjs/tools/MagnifyTool.js.map +1 -0
- package/dist/cjs/tools/annotation/AngleTool.d.ts +37 -0
- package/dist/cjs/tools/annotation/AngleTool.js +442 -0
- package/dist/cjs/tools/annotation/AngleTool.js.map +1 -0
- package/dist/cjs/tools/index.d.ts +3 -1
- package/dist/cjs/tools/index.js +5 -1
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/types/ToolSpecificAnnotationTypes.d.ts +24 -0
- package/dist/cjs/utilities/math/angle/angleBetweenLines.d.ts +4 -0
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js +17 -0
- package/dist/cjs/utilities/math/angle/angleBetweenLines.js.map +1 -0
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithToolEnabled.js +3 -0
- package/dist/cjs/utilities/viewportFilters/filterViewportsWithToolEnabled.js.map +1 -1
- package/dist/esm/enums/ToolBindings.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tools/MagnifyTool.d.ts +24 -0
- package/dist/esm/tools/MagnifyTool.js +163 -0
- package/dist/esm/tools/MagnifyTool.js.map +1 -0
- package/dist/esm/tools/annotation/AngleTool.d.ts +37 -0
- package/dist/esm/tools/annotation/AngleTool.js +417 -0
- package/dist/esm/tools/annotation/AngleTool.js.map +1 -0
- package/dist/esm/tools/index.d.ts +3 -1
- package/dist/esm/tools/index.js +3 -1
- package/dist/esm/tools/index.js.map +1 -1
- package/dist/esm/types/ToolSpecificAnnotationTypes.d.ts +24 -0
- package/dist/esm/utilities/math/angle/angleBetweenLines.d.ts +4 -0
- package/dist/esm/utilities/math/angle/angleBetweenLines.js +14 -0
- package/dist/esm/utilities/math/angle/angleBetweenLines.js.map +1 -0
- package/dist/esm/utilities/viewportFilters/filterViewportsWithToolEnabled.js +3 -0
- 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 +4 -4
package/dist/esm/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import * as cursors from './cursors';
|
|
|
8
8
|
import * as Types from './types';
|
|
9
9
|
import * as annotation from './stateManagement/annotation';
|
|
10
10
|
import * as segmentation from './stateManagement/segmentation';
|
|
11
|
-
import { BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, CrosshairsTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, SegmentationDisplayTool, BrushTool, } from './tools';
|
|
11
|
+
import { BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, CrosshairsTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, SegmentationDisplayTool, BrushTool, AngleTool, MagnifyTool, } from './tools';
|
|
12
12
|
import * as Enums from './enums';
|
|
13
|
-
export { init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, CrosshairsTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, synchronizers, Synchronizer, SynchronizerManager, Types, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
|
|
13
|
+
export { init, destroy, addTool, removeTool, cancelActiveManipulations, BaseTool, AnnotationTool, PanTool, DragProbeTool, WindowLevelTool, ZoomTool, StackScrollTool, StackScrollMouseWheelTool, VolumeRotateMouseWheelTool, MIPJumpToClickTool, LengthTool, CrosshairsTool, ProbeTool, RectangleROITool, EllipticalROITool, BidirectionalTool, PlanarFreehandROITool, ArrowAnnotateTool, AngleTool, MagnifyTool, SegmentationDisplayTool, RectangleScissorsTool, CircleScissorsTool, SphereScissorsTool, RectangleROIThresholdTool, RectangleROIStartEndThresholdTool, BrushTool, synchronizers, Synchronizer, SynchronizerManager, Types, ToolGroupManager, Enums, CONSTANTS, drawing, annotation, segmentation, utilities, cursors, };
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,cAAc,C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,EACR,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,uBAAuB,EACvB,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAEL,IAAI,EACJ,OAAO,EACP,OAAO,EACP,UAAU,EACV,yBAAyB,EAEzB,QAAQ,EACR,cAAc,EAEd,OAAO,EACP,aAAa,EACb,eAAe,EACf,QAAQ,EACR,eAAe,EACf,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAElB,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,SAAS,EACT,WAAW,EAEX,uBAAuB,EAEvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,SAAS,EAET,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,KAAK,EAEL,gBAAgB,EAEhB,KAAK,EAEL,SAAS,EAET,OAAO,EAEP,UAAU,EAEV,YAAY,EAEZ,SAAS,EACT,OAAO,GACR,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseTool } from './base';
|
|
2
|
+
import type { Types } from '@cornerstonejs/core';
|
|
3
|
+
import { EventTypes, PublicToolProps, ToolProps } from '../types';
|
|
4
|
+
import { IPoints } from '../types';
|
|
5
|
+
export default class MagnifyTool extends BaseTool {
|
|
6
|
+
static toolName: string;
|
|
7
|
+
mouseDragCallback: () => void;
|
|
8
|
+
_bounds: any;
|
|
9
|
+
editData: {
|
|
10
|
+
referencedImageId: string;
|
|
11
|
+
viewportIdsToRender: string[];
|
|
12
|
+
enabledElement: Types.IEnabledElement;
|
|
13
|
+
renderingEngine: Types.IRenderingEngine;
|
|
14
|
+
currentPoints: IPoints;
|
|
15
|
+
} | null;
|
|
16
|
+
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
|
|
17
|
+
_getReferencedImageId(viewport: Types.IStackViewport | Types.IVolumeViewport): string;
|
|
18
|
+
preMouseDownCallback: (evt: EventTypes.MouseDownActivateEventType) => boolean;
|
|
19
|
+
_createMagnificationViewport: () => void;
|
|
20
|
+
_mouseDragCallback: (evt: EventTypes.MouseDragEventType) => void;
|
|
21
|
+
_mouseUpCallback: (evt: EventTypes.MouseUpEventType) => void;
|
|
22
|
+
_activateDraw: (element: HTMLDivElement) => void;
|
|
23
|
+
_deactivateDraw: (element: HTMLDivElement) => void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { BaseTool } from './base';
|
|
2
|
+
import { Events } from '../enums';
|
|
3
|
+
import { getEnabledElement, StackViewport } from '@cornerstonejs/core';
|
|
4
|
+
import { getViewportIdsWithToolToRender } from '../utilities/viewportFilters';
|
|
5
|
+
import triggerAnnotationRenderForViewportIds from '../utilities/triggerAnnotationRenderForViewportIds';
|
|
6
|
+
import { state } from '../store';
|
|
7
|
+
import { Enums } from '@cornerstonejs/core';
|
|
8
|
+
import { hideElementCursor, resetElementCursor, } from '../cursors/elementCursor';
|
|
9
|
+
const MAGNIFY_VIEWPORT_ID = 'maginify-viewport';
|
|
10
|
+
export default class MagnifyTool extends BaseTool {
|
|
11
|
+
constructor(toolProps = {}, defaultToolProps = {
|
|
12
|
+
supportedInteractionTypes: ['Mouse', 'Touch'],
|
|
13
|
+
configuration: {
|
|
14
|
+
magnifySize: 10,
|
|
15
|
+
magnifyWidth: 250,
|
|
16
|
+
magnifyHeight: 250,
|
|
17
|
+
},
|
|
18
|
+
}) {
|
|
19
|
+
super(toolProps, defaultToolProps);
|
|
20
|
+
this.preMouseDownCallback = (evt) => {
|
|
21
|
+
const eventDetail = evt.detail;
|
|
22
|
+
const { currentPoints, element } = eventDetail;
|
|
23
|
+
const enabledElement = getEnabledElement(element);
|
|
24
|
+
const { viewport, renderingEngine } = enabledElement;
|
|
25
|
+
if (!(viewport instanceof StackViewport)) {
|
|
26
|
+
throw new Error('MagnifyTool only works on StackViewports');
|
|
27
|
+
}
|
|
28
|
+
const referencedImageId = this._getReferencedImageId(viewport);
|
|
29
|
+
if (!referencedImageId) {
|
|
30
|
+
throw new Error('MagnifyTool: No referenced image id found, reconstructed planes not supported yet');
|
|
31
|
+
}
|
|
32
|
+
const viewportIdsToRender = getViewportIdsWithToolToRender(element, this.getToolName());
|
|
33
|
+
this.editData = {
|
|
34
|
+
referencedImageId,
|
|
35
|
+
viewportIdsToRender,
|
|
36
|
+
enabledElement,
|
|
37
|
+
renderingEngine,
|
|
38
|
+
currentPoints,
|
|
39
|
+
};
|
|
40
|
+
this._createMagnificationViewport();
|
|
41
|
+
this._activateDraw(element);
|
|
42
|
+
hideElementCursor(element);
|
|
43
|
+
evt.preventDefault();
|
|
44
|
+
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
45
|
+
return true;
|
|
46
|
+
};
|
|
47
|
+
this._createMagnificationViewport = () => {
|
|
48
|
+
const { enabledElement, referencedImageId, viewportIdsToRender, renderingEngine, currentPoints, } = this.editData;
|
|
49
|
+
const { viewport } = enabledElement;
|
|
50
|
+
const { element } = viewport;
|
|
51
|
+
const { voiRange } = viewport.getProperties();
|
|
52
|
+
const { canvas: canvasPos, world: worldPos } = currentPoints;
|
|
53
|
+
let magnifyToolElement;
|
|
54
|
+
magnifyToolElement = element.querySelector('.magnifyTool');
|
|
55
|
+
if (magnifyToolElement === null) {
|
|
56
|
+
const magnifyElement = document.createElement('div');
|
|
57
|
+
magnifyElement.classList.add('magnifyTool');
|
|
58
|
+
magnifyElement.style.display = 'block';
|
|
59
|
+
magnifyElement.style.width = `${this.configuration.magnifyWidth}px`;
|
|
60
|
+
magnifyElement.style.height = `${this.configuration.magnifyHeight}px`;
|
|
61
|
+
magnifyElement.style.position = 'absolute';
|
|
62
|
+
magnifyToolElement = magnifyElement;
|
|
63
|
+
const viewportElement = element.querySelector('.viewport-element');
|
|
64
|
+
viewportElement.appendChild(magnifyElement);
|
|
65
|
+
const viewportInput = {
|
|
66
|
+
viewportId: MAGNIFY_VIEWPORT_ID,
|
|
67
|
+
type: Enums.ViewportType.STACK,
|
|
68
|
+
element: magnifyToolElement,
|
|
69
|
+
};
|
|
70
|
+
renderingEngine.enableElement(viewportInput);
|
|
71
|
+
}
|
|
72
|
+
magnifyToolElement.style.top = `${canvasPos[1] - this.configuration.magnifyHeight / 2}px`;
|
|
73
|
+
magnifyToolElement.style.left = `${canvasPos[0] - this.configuration.magnifyWidth / 2}px`;
|
|
74
|
+
const magnifyViewport = renderingEngine.getViewport(MAGNIFY_VIEWPORT_ID);
|
|
75
|
+
magnifyViewport.setStack([referencedImageId]).then(() => {
|
|
76
|
+
magnifyViewport.setProperties({ voiRange });
|
|
77
|
+
const { parallelScale } = viewport.getCamera();
|
|
78
|
+
const { focalPoint, position, viewPlaneNormal } = magnifyViewport.getCamera();
|
|
79
|
+
const distance = Math.sqrt(Math.pow(focalPoint[0] - position[0], 2) +
|
|
80
|
+
Math.pow(focalPoint[1] - position[1], 2) +
|
|
81
|
+
Math.pow(focalPoint[2] - position[2], 2));
|
|
82
|
+
const updatedFocalPoint = [
|
|
83
|
+
worldPos[0],
|
|
84
|
+
worldPos[1],
|
|
85
|
+
worldPos[2],
|
|
86
|
+
];
|
|
87
|
+
const updatedPosition = [
|
|
88
|
+
updatedFocalPoint[0] + distance * viewPlaneNormal[0],
|
|
89
|
+
updatedFocalPoint[1] + distance * viewPlaneNormal[1],
|
|
90
|
+
updatedFocalPoint[2] + distance * viewPlaneNormal[2],
|
|
91
|
+
];
|
|
92
|
+
magnifyViewport.setCamera({
|
|
93
|
+
parallelScale: parallelScale * (1 / this.configuration.magnifySize),
|
|
94
|
+
focalPoint: updatedFocalPoint,
|
|
95
|
+
position: updatedPosition,
|
|
96
|
+
});
|
|
97
|
+
magnifyViewport.render();
|
|
98
|
+
});
|
|
99
|
+
magnifyToolElement.style.display = 'block';
|
|
100
|
+
triggerAnnotationRenderForViewportIds(renderingEngine, viewportIdsToRender);
|
|
101
|
+
};
|
|
102
|
+
this._mouseDragCallback = (evt) => {
|
|
103
|
+
const eventDetail = evt.detail;
|
|
104
|
+
const { currentPoints, deltaPoints, element } = eventDetail;
|
|
105
|
+
const deltaPointsWorld = deltaPoints.world;
|
|
106
|
+
const canvasPos = currentPoints.canvas;
|
|
107
|
+
const enabledElement = getEnabledElement(element);
|
|
108
|
+
const { renderingEngine } = enabledElement;
|
|
109
|
+
const magnifyViewport = renderingEngine.getViewport(MAGNIFY_VIEWPORT_ID);
|
|
110
|
+
const magnifyElement = element.querySelector('.magnifyTool');
|
|
111
|
+
if (!magnifyElement) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
magnifyElement.style.top = `${canvasPos[1] - this.configuration.magnifyHeight / 2}px`;
|
|
115
|
+
magnifyElement.style.left = `${canvasPos[0] - this.configuration.magnifyWidth / 2}px`;
|
|
116
|
+
const { focalPoint, position } = magnifyViewport.getCamera();
|
|
117
|
+
const updatedPosition = [
|
|
118
|
+
position[0] + deltaPointsWorld[0],
|
|
119
|
+
position[1] + deltaPointsWorld[1],
|
|
120
|
+
position[2] + deltaPointsWorld[2],
|
|
121
|
+
];
|
|
122
|
+
const updatedFocalPoint = [
|
|
123
|
+
focalPoint[0] + deltaPointsWorld[0],
|
|
124
|
+
focalPoint[1] + deltaPointsWorld[1],
|
|
125
|
+
focalPoint[2] + deltaPointsWorld[2],
|
|
126
|
+
];
|
|
127
|
+
magnifyViewport.setCamera({
|
|
128
|
+
focalPoint: updatedFocalPoint,
|
|
129
|
+
position: updatedPosition,
|
|
130
|
+
});
|
|
131
|
+
magnifyViewport.render();
|
|
132
|
+
};
|
|
133
|
+
this._mouseUpCallback = (evt) => {
|
|
134
|
+
const { element } = evt.detail;
|
|
135
|
+
const magnifyToolElement = element.querySelector('.magnifyTool');
|
|
136
|
+
magnifyToolElement.style.display = 'none';
|
|
137
|
+
this._deactivateDraw(element);
|
|
138
|
+
resetElementCursor(element);
|
|
139
|
+
};
|
|
140
|
+
this._activateDraw = (element) => {
|
|
141
|
+
state.isInteractingWithTool = true;
|
|
142
|
+
element.addEventListener(Events.MOUSE_UP, this._mouseUpCallback);
|
|
143
|
+
element.addEventListener(Events.MOUSE_DRAG, this._mouseDragCallback);
|
|
144
|
+
element.addEventListener(Events.MOUSE_CLICK, this._mouseUpCallback);
|
|
145
|
+
};
|
|
146
|
+
this._deactivateDraw = (element) => {
|
|
147
|
+
state.isInteractingWithTool = false;
|
|
148
|
+
element.removeEventListener(Events.MOUSE_UP, this._mouseUpCallback);
|
|
149
|
+
element.removeEventListener(Events.MOUSE_DRAG, this._mouseDragCallback);
|
|
150
|
+
element.removeEventListener(Events.MOUSE_CLICK, this._mouseUpCallback);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
_getReferencedImageId(viewport) {
|
|
154
|
+
const targetId = this.getTargetId(viewport);
|
|
155
|
+
let referencedImageId;
|
|
156
|
+
if (viewport instanceof StackViewport) {
|
|
157
|
+
referencedImageId = targetId.split('imageId:')[1];
|
|
158
|
+
}
|
|
159
|
+
return referencedImageId;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
MagnifyTool.toolName = 'Magnify';
|
|
163
|
+
//# sourceMappingURL=MagnifyTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MagnifyTool.js","sourceRoot":"","sources":["../../../src/tools/MagnifyTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,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B,CAAC,CAAC;QACzE,CAAC,CAAC;IArOF,CAAC;IAED,qBAAqB,CACnB,QAAsD;QAEtD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAE5C,IAAI,iBAAiB,CAAC;QAEtB,IAAI,QAAQ,YAAY,aAAa,EAAE;YACrC,iBAAiB,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SACnD;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;;AArCM,oBAAQ,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
2
|
+
import { AnnotationTool } from '../base';
|
|
3
|
+
import { EventTypes, ToolHandle, PublicToolProps, ToolProps, InteractionTypes } from '../../types';
|
|
4
|
+
import { AngleAnnotation } from '../../types/ToolSpecificAnnotationTypes';
|
|
5
|
+
declare class AngleTool extends AnnotationTool {
|
|
6
|
+
static toolName: string;
|
|
7
|
+
touchDragCallback: any;
|
|
8
|
+
mouseDragCallback: any;
|
|
9
|
+
angleStartedNotYetCompleted: boolean;
|
|
10
|
+
_throttledCalculateCachedStats: any;
|
|
11
|
+
editData: {
|
|
12
|
+
annotation: any;
|
|
13
|
+
viewportIdsToRender: string[];
|
|
14
|
+
handleIndex?: number;
|
|
15
|
+
movingTextBox?: boolean;
|
|
16
|
+
newAnnotation?: boolean;
|
|
17
|
+
hasMoved?: boolean;
|
|
18
|
+
} | null;
|
|
19
|
+
isDrawing: boolean;
|
|
20
|
+
isHandleOutsideImage: boolean;
|
|
21
|
+
constructor(toolProps?: PublicToolProps, defaultToolProps?: ToolProps);
|
|
22
|
+
addNewAnnotation: (evt: EventTypes.MouseDownActivateEventType) => AngleAnnotation;
|
|
23
|
+
isPointNearTool: (element: HTMLDivElement, annotation: AngleAnnotation, canvasCoords: Types.Point2, proximity: number) => boolean;
|
|
24
|
+
toolSelectedCallback: (evt: EventTypes.MouseDownEventType, annotation: AngleAnnotation, interactionType: InteractionTypes) => void;
|
|
25
|
+
handleSelectedCallback(evt: EventTypes.MouseDownEventType, annotation: AngleAnnotation, handle: ToolHandle, interactionType?: string): void;
|
|
26
|
+
_mouseUpCallback: (evt: EventTypes.MouseUpEventType | EventTypes.MouseClickEventType) => void;
|
|
27
|
+
_mouseDragCallback: (evt: EventTypes.MouseDragEventType | EventTypes.MouseMoveEventType) => void;
|
|
28
|
+
cancel: (element: HTMLDivElement) => any;
|
|
29
|
+
_activateModify: (element: HTMLDivElement) => void;
|
|
30
|
+
_deactivateModify: (element: HTMLDivElement) => void;
|
|
31
|
+
_activateDraw: (element: HTMLDivElement) => void;
|
|
32
|
+
_deactivateDraw: (element: HTMLDivElement) => void;
|
|
33
|
+
renderAnnotation: (enabledElement: Types.IEnabledElement, svgDrawingHelper: any) => void;
|
|
34
|
+
_getTextLines(data: any, targetId: any): string[];
|
|
35
|
+
_calculateCachedStats(annotation: any, renderingEngine: any, enabledElement: any): any;
|
|
36
|
+
}
|
|
37
|
+
export default AngleTool;
|