Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove unnecessary event firing for annotations #123

Merged
merged 10 commits into from
Jun 14, 2022
7 changes: 6 additions & 1 deletion common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ interface CPUFallbackTransform {
// @public (undocumented)
type CPUFallbackViewport = {
scale?: number;
parallelScale?: number;
focalPoint?: number[];
translation?: {
x: number;
y: number;
Expand Down Expand Up @@ -654,6 +656,8 @@ interface ICamera {
// (undocumented)
position?: Point3;
// (undocumented)
scale?: number;
// (undocumented)
viewAngle?: number;
// (undocumented)
viewPlaneNormal?: Point3;
Expand Down Expand Up @@ -1696,7 +1700,7 @@ export class StackViewport extends Viewport implements IStackViewport {
// (undocumented)
setImageIdIndex(imageIdIndex: number): Promise<string>;
// (undocumented)
setProperties({ voiRange, invert, interpolationType, rotation, }?: StackViewportProperties): void;
setProperties({ voiRange, invert, interpolationType, rotation, }?: StackViewportProperties, suppressEvents?: boolean): void;
// (undocumented)
setStack(imageIds: Array<string>, currentImageIdIndex?: number): Promise<string>;
// (undocumented)
Expand Down Expand Up @@ -1724,6 +1728,7 @@ type StackViewportProperties = {
invert?: boolean;
interpolationType?: InterpolationType;
rotation?: number;
suppressEvents?: boolean;
};

// @public (undocumented)
Expand Down
4 changes: 4 additions & 0 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ interface CPUFallbackTransform {
// @public (undocumented)
type CPUFallbackViewport = {
scale?: number;
parallelScale?: number;
focalPoint?: number[];
translation?: {
x: number;
y: number;
Expand Down Expand Up @@ -503,6 +505,7 @@ interface ICamera {
parallelProjection?: boolean;
parallelScale?: number;
position?: Point3;
scale?: number;
viewAngle?: number;
viewPlaneNormal?: Point3;
viewUp?: Point3;
Expand Down Expand Up @@ -1109,6 +1112,7 @@ type StackViewportProperties = {
invert?: boolean;
interpolationType?: InterpolationType;
rotation?: number;
suppressEvents?: boolean;
};

// @public (undocumented)
Expand Down
82 changes: 44 additions & 38 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class AngleTool extends AnnotationTool {
// (undocumented)
_mouseUpCallback: (evt: EventTypes_2.MouseUpEventType | EventTypes_2.MouseClickEventType) => void;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -329,7 +329,7 @@ export abstract class AnnotationTool extends BaseTool {
// (undocumented)
onImageSpacingCalibrated: (evt: Types_2.EventTypes.ImageSpacingCalibratedEvent) => void;
// (undocumented)
abstract renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any): any;
abstract renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): any;
// (undocumented)
static toolName: string;
// (undocumented)
Expand Down Expand Up @@ -391,7 +391,7 @@ export class ArrowAnnotateTool extends AnnotationTool {
// (undocumented)
_mouseUpCallback: (evt: EventTypes_2.MouseUpEventType | EventTypes_2.MouseClickEventType) => void;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -535,7 +535,7 @@ export class BidirectionalTool extends AnnotationTool {
// (undocumented)
preventHandleOutsideImage: boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -564,7 +564,7 @@ export class BrushTool extends BaseTool {
// (undocumented)
preMouseDownCallback: (evt: EventTypes_2.MouseDownActivateEventType) => boolean;
// (undocumented)
renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any): void;
renderAnnotation(enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper): void;
// (undocumented)
static toolName: string;
}
Expand Down Expand Up @@ -647,7 +647,7 @@ export class CircleScissorsTool extends BaseTool {
// (undocumented)
preMouseDownCallback: (evt: EventTypes_2.MouseDownActivateEventType) => boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
static toolName: string;
}
Expand Down Expand Up @@ -911,6 +911,8 @@ interface CPUFallbackTransform {
// @public (undocumented)
type CPUFallbackViewport = {
scale?: number;
parallelScale?: number;
focalPoint?: number[];
translation?: {
x: number;
y: number;
Expand Down Expand Up @@ -1085,7 +1087,7 @@ export class CrosshairsTool extends AnnotationTool {
// (undocumented)
_pointNearTool(element: any, annotation: any, canvasCoords: any, proximity: any): boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
setSlabThickness(viewport: any, slabThickness: any): void;
// (undocumented)
Expand Down Expand Up @@ -1195,7 +1197,7 @@ export class DragProbeTool extends ProbeTool {
// (undocumented)
postMouseDownCallback: (evt: EventTypes_2.MouseDownActivateEventType) => ProbeAnnotation;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
static toolName: string;
// (undocumented)
Expand All @@ -1206,16 +1208,16 @@ export class DragProbeTool extends ProbeTool {
function draw(element: HTMLDivElement, fn: (svgDrawingElement: any) => any): void;

// @public (undocumented)
function drawArrow(svgDrawingHelper: any, annotationUID: string, arrowUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void;
function drawArrow(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, arrowUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void;

// @public (undocumented)
function drawCircle(svgDrawingHelper: any, annotationUID: string, circleUID: string, center: Types_2.Point2, radius: number, options?: {}): void;
function drawCircle(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, circleUID: string, center: Types_2.Point2, radius: number, options?: {}): void;

// @public (undocumented)
function drawEllipse(svgDrawingHelper: any, annotationUID: string, ellipseUID: string, corner1: Types_2.Point2, corner2: Types_2.Point2, options?: {}): void;
function drawEllipse(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, ellipseUID: string, corner1: Types_2.Point2, corner2: Types_2.Point2, options?: {}): void;

// @public (undocumented)
function drawHandles(svgDrawingHelper: any, annotationUID: string, handleGroupUID: string, handlePoints: Array<Types_2.Point2>, options?: {}): void;
function drawHandles(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, handleGroupUID: string, handlePoints: Array<Types_2.Point2>, options?: {}): void;

declare namespace drawing {
export {
Expand All @@ -1240,13 +1242,13 @@ declare namespace drawing_2 {
}

// @public (undocumented)
function drawLine(svgDrawingHelper: any, annotationUID: string, lineUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void;
function drawLine(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, lineUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void;

// @public (undocumented)
function drawLinkedTextBox(svgDrawingHelper: Record<string, unknown>, annotationUID: string, textBoxUID: string, textLines: Array<string>, textBoxPosition: Types_2.Point2, annotationAnchorPoints: Array<Types_2.Point2>, textBox: unknown, options?: {}): SVGRect;
function drawLinkedTextBox(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, textBoxUID: string, textLines: Array<string>, textBoxPosition: Types_2.Point2, annotationAnchorPoints: Array<Types_2.Point2>, textBox: unknown, options?: {}): SVGRect;

// @public (undocumented)
function drawPolyline(svgDrawingHelper: any, annotationUID: string, polylineUID: string, points: Types_2.Point2[], options: {
function drawPolyline(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, polylineUID: string, points: Types_2.Point2[], options: {
color?: string;
width?: number;
lineWidth?: number;
Expand All @@ -1255,10 +1257,10 @@ function drawPolyline(svgDrawingHelper: any, annotationUID: string, polylineUID:
}): void;

// @public (undocumented)
function drawRect(svgDrawingHelper: any, annotationUID: string, rectangleUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void;
function drawRect(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, rectangleUID: string, start: Types_2.Point2, end: Types_2.Point2, options?: {}): void;

// @public (undocumented)
function drawTextBox(svgDrawingHelper: Record<string, unknown>, annotationUID: string, textUID: string, textLines: Array<string>, position: Types_2.Point2, options?: {}): SVGRect;
function drawTextBox(svgDrawingHelper: SVGDrawingHelper, annotationUID: string, textUID: string, textLines: Array<string>, position: Types_2.Point2, options?: {}): SVGRect;

declare namespace elementCursor {
export {
Expand Down Expand Up @@ -1374,7 +1376,7 @@ export class EllipticalROITool extends AnnotationTool {
// (undocumented)
_pointInEllipseCanvas(ellipse: any, location: Types_2.Point2): boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -1817,6 +1819,7 @@ interface ICamera {
parallelProjection?: boolean;
parallelScale?: number;
position?: Point3;
scale?: number;
viewAngle?: number;
viewPlaneNormal?: Point3;
viewUp?: Point3;
Expand Down Expand Up @@ -2554,7 +2557,7 @@ export class LengthTool extends AnnotationTool {
// (undocumented)
_mouseUpCallback: (evt: EventTypes_2.MouseUpEventType | EventTypes_2.MouseClickEventType) => void;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -2904,7 +2907,7 @@ export class PlanarFreehandROITool extends AnnotationTool {
// (undocumented)
mouseDragCallback: any;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -3044,7 +3047,7 @@ export class ProbeTool extends AnnotationTool {
// (undocumented)
_mouseUpCallback: (evt: EventTypes_2.MouseUpEventType | EventTypes_2.MouseClickEventType) => void;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
static toolName: string;
// (undocumented)
Expand Down Expand Up @@ -3192,7 +3195,7 @@ export class RectangleROIStartEndThresholdTool extends RectangleROITool {
// (undocumented)
isHandleOutsideImage: boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -3267,7 +3270,7 @@ export class RectangleROIThresholdTool extends RectangleROITool {
// (undocumented)
isHandleOutsideImage: boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -3327,7 +3330,7 @@ export class RectangleROITool extends AnnotationTool {
// (undocumented)
_mouseUpCallback: (evt: EventTypes_2.MouseUpEventType | EventTypes_2.MouseClickEventType) => void;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -3374,7 +3377,7 @@ export class RectangleScissorsTool extends BaseTool {
// (undocumented)
preMouseDownCallback: (evt: EventTypes_2.MouseDownActivateEventType) => boolean;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
_throttledCalculateCachedStats: any;
// (undocumented)
Expand Down Expand Up @@ -3696,7 +3699,7 @@ export class SphereScissorsTool extends BaseTool {
// (undocumented)
preMouseDownCallback: (evt: EventTypes_2.MouseDownActivateEventType) => true;
// (undocumented)
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: any) => void;
renderAnnotation: (enabledElement: Types_2.IEnabledElement, svgDrawingHelper: SVGDrawingHelper) => boolean;
// (undocumented)
static toolName: string;
}
Expand Down Expand Up @@ -3776,6 +3779,7 @@ type StackViewportProperties = {
invert?: boolean;
interpolationType?: InterpolationType;
rotation?: number;
suppressEvents?: boolean;
};

// @public (undocumented)
Expand Down Expand Up @@ -3855,6 +3859,16 @@ type SVGCursorDescriptor = {
mousePointerGroupString: string;
};

// @public (undocumented)
type SVGDrawingHelper = {
svgLayerElement: HTMLDivElement;
svgNodeCacheForCanvas: Record<string, unknown>;
getSvgNode: (cacheKey: string) => SVGGElement | undefined;
appendNode: (svgNode: SVGElement, cacheKey: string) => void;
setNodeTouched: (cacheKey: string) => void;
clearUntouched: () => void;
};

// @public (undocumented)
class SVGMouseCursor extends ImageMouseCursor {
constructor(url: string, x?: number, y?: number, name?: string | undefined, fallback?: MouseCursor | undefined);
Expand Down Expand Up @@ -4144,7 +4158,8 @@ declare namespace Types {
SVGPoint_2 as SVGPoint,
ScrollOptions_2 as ScrollOptions,
CINETypes,
BoundsIJK
BoundsIJK,
SVGDrawingHelper
}
}
export { Types }
Expand Down Expand Up @@ -4366,21 +4381,12 @@ export class ZoomTool extends BaseTool {
// (undocumented)
_dragCallback(evt: EventTypes_2.MouseDragEventType): void;
// (undocumented)
_dragParallelProjection: (evt: EventTypes_2.MouseDragEventType, camera: Types_2.ICamera) => void;
// (undocumented)
_dragPerspectiveProjection: (evt: any, camera: any) => void;
_dragParallelProjection: (evt: EventTypes_2.MouseDragEventType, viewport: Types_2.IStackViewport | Types_2.IVolumeViewport, camera: Types_2.ICamera) => void;
// (undocumented)
_getCappedParallelScale: (viewport: any, parallelScale: any) => {
parallelScale: any;
thresholdExceeded: boolean;
};
_dragPerspectiveProjection: (evt: any, viewport: any, camera: any) => void;
// (undocumented)
initialMousePosWorld: Types_2.Point3;
// (undocumented)
maxZoomScale: number;
// (undocumented)
minZoomScale: number;
// (undocumented)
mouseDragCallback: () => void;
// (undocumented)
preMouseDownCallback: (evt: EventTypes_2.MouseDownActivateEventType) => boolean;
Expand Down
Loading