@markerjs/markerjs3 3.0.0-beta.3 → 3.0.0-rc.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/markerjs3.d.ts +1180 -393
- package/markerjs3.js +1 -1
- package/markerjs3.js.map +1 -1
- package/package.json +1 -1
- package/umd/markerjs3.js +1 -1
- package/umd/markerjs3.js.map +1 -1
package/markerjs3.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Describes point objects
|
|
2
|
+
* Describes a point objects use internally
|
|
3
3
|
*/
|
|
4
4
|
interface IPoint {
|
|
5
5
|
/**
|
|
@@ -12,6 +12,32 @@ interface IPoint {
|
|
|
12
12
|
y: number;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Describes a size
|
|
17
|
+
*/
|
|
18
|
+
interface ISize {
|
|
19
|
+
/**
|
|
20
|
+
* Width
|
|
21
|
+
*/
|
|
22
|
+
width: number;
|
|
23
|
+
/**
|
|
24
|
+
* Height
|
|
25
|
+
*/
|
|
26
|
+
height: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Represents a simplified version of the SVGMatrix.
|
|
31
|
+
*/
|
|
32
|
+
interface ITransformMatrix {
|
|
33
|
+
a: number;
|
|
34
|
+
b: number;
|
|
35
|
+
c: number;
|
|
36
|
+
d: number;
|
|
37
|
+
e: number;
|
|
38
|
+
f: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
15
41
|
/**
|
|
16
42
|
* Utility class to simplify SVG operations.
|
|
17
43
|
*/
|
|
@@ -132,7 +158,40 @@ declare class SvgHelper {
|
|
|
132
158
|
}
|
|
133
159
|
|
|
134
160
|
/**
|
|
135
|
-
*
|
|
161
|
+
* Manages commercial licenses.
|
|
162
|
+
* @ignore
|
|
163
|
+
*/
|
|
164
|
+
declare class Activator {
|
|
165
|
+
private static keys;
|
|
166
|
+
private static keyAddListeners;
|
|
167
|
+
/**
|
|
168
|
+
* Add a license key
|
|
169
|
+
* @param product product identifier.
|
|
170
|
+
* @param key license key sent to you after purchase.
|
|
171
|
+
*/
|
|
172
|
+
static addKey(product: string, key: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* Add a function to be called when license key is added.
|
|
175
|
+
* @param listener
|
|
176
|
+
*/
|
|
177
|
+
static addKeyAddListener(listener: () => void): void;
|
|
178
|
+
/**
|
|
179
|
+
* Remove a function called when key is added.
|
|
180
|
+
* @param listener
|
|
181
|
+
*/
|
|
182
|
+
static removeKeyAddListener(listener: () => void): void;
|
|
183
|
+
/**
|
|
184
|
+
* Returns true if the product is commercially licensed.
|
|
185
|
+
* @param product product identifier.
|
|
186
|
+
*/
|
|
187
|
+
static isLicensed(product: string): boolean;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Represents marker's state used to save and restore state.
|
|
192
|
+
*
|
|
193
|
+
* The state can then be serialized and stored for future use like to continue
|
|
194
|
+
* annotation in the future, display it in a viewer or render as a static image.
|
|
136
195
|
*/
|
|
137
196
|
interface MarkerBaseState {
|
|
138
197
|
/**
|
|
@@ -143,38 +202,100 @@ interface MarkerBaseState {
|
|
|
143
202
|
* Additional information about the marker.
|
|
144
203
|
*/
|
|
145
204
|
notes?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Marker's stroke (outline) color.
|
|
207
|
+
*/
|
|
146
208
|
strokeColor?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Marker's stroke (outline) width.
|
|
211
|
+
*/
|
|
147
212
|
strokeWidth?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Marker's stroke (outline) dash array.
|
|
215
|
+
*/
|
|
148
216
|
strokeDasharray?: string;
|
|
217
|
+
/**
|
|
218
|
+
* Marker's opacity.
|
|
219
|
+
*/
|
|
149
220
|
opacity?: number;
|
|
150
221
|
}
|
|
151
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Represents the state of the annotation.
|
|
225
|
+
*
|
|
226
|
+
* The state is returned by {@link Editor!MarkerArea.getState | MarkerArea.getState()} and can be used to
|
|
227
|
+
* restore the annotation in {@link Editor!MarkerArea | MarkerArea}
|
|
228
|
+
* with {@link Editor!MarkerArea.restoreState | MarkerArea.restoreState()}
|
|
229
|
+
* or passed to {@link Viewer!MarkerView.show | MakerView.show()}
|
|
230
|
+
* or {@link Renderer!Renderer.rasterize | Renderer.rasterize()}.
|
|
231
|
+
*/
|
|
152
232
|
interface AnnotationState {
|
|
233
|
+
/**
|
|
234
|
+
* Version of the annotation state format.
|
|
235
|
+
*
|
|
236
|
+
* Equals to 3 for the current version.
|
|
237
|
+
*/
|
|
153
238
|
version?: number;
|
|
239
|
+
/**
|
|
240
|
+
* Width of the annotation.
|
|
241
|
+
*/
|
|
154
242
|
width: number;
|
|
243
|
+
/**
|
|
244
|
+
* Height of the annotation.
|
|
245
|
+
*/
|
|
155
246
|
height: number;
|
|
247
|
+
/**
|
|
248
|
+
* Array of marker states for markers in the annotation.
|
|
249
|
+
*/
|
|
156
250
|
markers: MarkerBaseState[];
|
|
157
251
|
}
|
|
158
252
|
|
|
159
253
|
/**
|
|
160
|
-
*
|
|
254
|
+
* Represents a stage in a marker's lifecycle.
|
|
255
|
+
*
|
|
256
|
+
* Most markers are created immediately after the user clicks on the canvas.
|
|
257
|
+
* However, some markers are only finished creating after additional interactions.
|
|
161
258
|
*/
|
|
162
|
-
interface ISize {
|
|
163
|
-
width: number;
|
|
164
|
-
height: number;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
259
|
type MarkerStage = 'creating' | 'normal';
|
|
260
|
+
/**
|
|
261
|
+
* Base class for all markers.
|
|
262
|
+
*
|
|
263
|
+
* When creating custom marker types usually you will want to extend one of the derived classes.
|
|
264
|
+
* However, if you cannot find a suitable base class, you can and you should extend this class.
|
|
265
|
+
*
|
|
266
|
+
* @summary Base class for all markers.
|
|
267
|
+
* @group Markers
|
|
268
|
+
*/
|
|
168
269
|
declare class MarkerBase {
|
|
270
|
+
/**
|
|
271
|
+
* Marker type name.
|
|
272
|
+
*
|
|
273
|
+
* It's important to set this in each derived class. This value is used to identify marker types
|
|
274
|
+
* when restoring marker state and other scenarios.
|
|
275
|
+
*/
|
|
169
276
|
static typeName: string;
|
|
277
|
+
/**
|
|
278
|
+
* Returns marker type name for the object instance.
|
|
279
|
+
*/
|
|
170
280
|
get typeName(): string;
|
|
281
|
+
/**
|
|
282
|
+
* SVG container object holding the marker's visual.
|
|
283
|
+
*
|
|
284
|
+
* It is created and passed to the constructor by marker editor or viewer when creating the marker.
|
|
285
|
+
*/
|
|
171
286
|
protected _container: SVGGElement;
|
|
287
|
+
/**
|
|
288
|
+
* SVG container object holding the marker's visual.
|
|
289
|
+
*/
|
|
172
290
|
/**
|
|
173
291
|
* SVG container object holding the marker's visual.
|
|
174
292
|
*/
|
|
175
293
|
get container(): SVGGElement;
|
|
176
294
|
/**
|
|
177
|
-
* Additional information about the marker
|
|
295
|
+
* Additional information about the marker.
|
|
296
|
+
*
|
|
297
|
+
* Generally, this isn't used for anything functional.
|
|
298
|
+
* However, in a derived type it could be used for storing arbitrary data with no need to create extra properties and state types.
|
|
178
299
|
*/
|
|
179
300
|
notes?: string;
|
|
180
301
|
/**
|
|
@@ -185,39 +306,120 @@ declare class MarkerBase {
|
|
|
185
306
|
* Marker type title (display name) used for accessibility and other attributes.
|
|
186
307
|
*/
|
|
187
308
|
static title: string;
|
|
309
|
+
/**
|
|
310
|
+
* Marker lifecycle stage.
|
|
311
|
+
*
|
|
312
|
+
* Most markers are created immediately after the user clicks on the canvas (`normal`).
|
|
313
|
+
* However, some markers are only finished creating after additional interactions (`creating`).
|
|
314
|
+
*/
|
|
188
315
|
stage: MarkerStage;
|
|
316
|
+
/**
|
|
317
|
+
* Stroke (outline) color of the marker.
|
|
318
|
+
*/
|
|
189
319
|
protected _strokeColor: string;
|
|
320
|
+
/**
|
|
321
|
+
* Stroke (outline) color of the marker.
|
|
322
|
+
*
|
|
323
|
+
* In a derived class override {@link applyStrokeColor} to apply the color to the marker's visual.
|
|
324
|
+
*/
|
|
190
325
|
get strokeColor(): string;
|
|
191
326
|
set strokeColor(color: string);
|
|
327
|
+
/**
|
|
328
|
+
* Applies the stroke color to the marker's visual.
|
|
329
|
+
*
|
|
330
|
+
* Override this method in a derived class to apply the color to the marker's visual.
|
|
331
|
+
*/
|
|
192
332
|
protected applyStrokeColor(): void;
|
|
333
|
+
/**
|
|
334
|
+
* Fill color of the marker.
|
|
335
|
+
*/
|
|
193
336
|
protected _fillColor: string;
|
|
337
|
+
/**
|
|
338
|
+
* Fill color of the marker.
|
|
339
|
+
*
|
|
340
|
+
* In a derived class override {@link applyFillColor} to apply the color to the marker's visual.
|
|
341
|
+
*/
|
|
194
342
|
get fillColor(): string;
|
|
195
343
|
set fillColor(color: string);
|
|
344
|
+
/**
|
|
345
|
+
* Applies the fill color to the marker's visual.
|
|
346
|
+
*
|
|
347
|
+
* Override this method in a derived class to apply the color to the marker's visual.
|
|
348
|
+
*/
|
|
196
349
|
protected applyFillColor(): void;
|
|
350
|
+
/**
|
|
351
|
+
* Stroke (outline) width of the marker.
|
|
352
|
+
*/
|
|
197
353
|
protected _strokeWidth: number;
|
|
354
|
+
/**
|
|
355
|
+
* Stroke (outline) width of the marker.
|
|
356
|
+
*
|
|
357
|
+
* In a derived class override {@link applyStrokeWidth} to apply the width to the marker's visual.
|
|
358
|
+
*/
|
|
198
359
|
get strokeWidth(): number;
|
|
199
360
|
set strokeWidth(value: number);
|
|
361
|
+
/**
|
|
362
|
+
* Applies the stroke width to the marker's visual.
|
|
363
|
+
*
|
|
364
|
+
* Override this method in a derived class to apply the width to the marker's visual.
|
|
365
|
+
*/
|
|
200
366
|
protected applyStrokeWidth(): void;
|
|
367
|
+
/**
|
|
368
|
+
* Stroke (outline) dash array of the marker.
|
|
369
|
+
*/
|
|
201
370
|
protected _strokeDasharray: string;
|
|
371
|
+
/**
|
|
372
|
+
* Stroke (outline) dash array of the marker.
|
|
373
|
+
*
|
|
374
|
+
* In a derived class override {@link applyStrokeDasharray} to apply the dash array to the marker's visual.
|
|
375
|
+
*/
|
|
202
376
|
get strokeDasharray(): string;
|
|
203
377
|
set strokeDasharray(value: string);
|
|
378
|
+
/**
|
|
379
|
+
* Applies the stroke dash array to the marker's visual.
|
|
380
|
+
*
|
|
381
|
+
* Override this method in a derived class to apply the dash array to the marker's visual.
|
|
382
|
+
*/
|
|
204
383
|
protected applyStrokeDasharray(): void;
|
|
384
|
+
/**
|
|
385
|
+
* Opacity of the marker.
|
|
386
|
+
*/
|
|
205
387
|
protected _opacity: number;
|
|
388
|
+
/**
|
|
389
|
+
* Opacity of the marker.
|
|
390
|
+
*
|
|
391
|
+
* In a derived class override {@link applyOpacity} to apply the opacity to the marker's visual.
|
|
392
|
+
*/
|
|
206
393
|
get opacity(): number;
|
|
207
394
|
set opacity(value: number);
|
|
395
|
+
/**
|
|
396
|
+
* Applies the opacity to the marker's visual.
|
|
397
|
+
*
|
|
398
|
+
* Override this method in a derived class to apply the opacity to the marker's visual
|
|
399
|
+
*/
|
|
208
400
|
protected applyOpacity(): void;
|
|
401
|
+
/**
|
|
402
|
+
* Creates a new marker object.
|
|
403
|
+
*
|
|
404
|
+
* @param container - SVG container object holding the marker's visual.
|
|
405
|
+
*/
|
|
209
406
|
constructor(container: SVGGElement);
|
|
210
407
|
/**
|
|
211
408
|
* Returns true if passed SVG element belongs to the marker. False otherwise.
|
|
212
409
|
*
|
|
213
410
|
* @param el - target element.
|
|
411
|
+
* @returns true if the element belongs to the marker.
|
|
214
412
|
*/
|
|
215
413
|
ownsTarget(el: EventTarget): boolean;
|
|
216
414
|
/**
|
|
217
|
-
* Disposes the marker and
|
|
415
|
+
* Disposes the marker and cleans up.
|
|
218
416
|
*/
|
|
219
417
|
dispose(): void;
|
|
220
418
|
protected addMarkerVisualToContainer(element: SVGElement): void;
|
|
419
|
+
/**
|
|
420
|
+
* When overridden in a derived class, represents a preliminary outline for markers that can be displayed before the marker is actually created.
|
|
421
|
+
* @returns SVG path string.
|
|
422
|
+
*/
|
|
221
423
|
getOutline(): string;
|
|
222
424
|
/**
|
|
223
425
|
* Returns current marker state that can be restored in the future.
|
|
@@ -230,7 +432,7 @@ declare class MarkerBase {
|
|
|
230
432
|
*/
|
|
231
433
|
restoreState(state: MarkerBaseState): void;
|
|
232
434
|
/**
|
|
233
|
-
* Scales marker. Used after
|
|
435
|
+
* Scales marker. Used after resize.
|
|
234
436
|
*
|
|
235
437
|
* @param scaleX - horizontal scale
|
|
236
438
|
* @param scaleY - vertical scale
|
|
@@ -246,18 +448,6 @@ declare class MarkerBase {
|
|
|
246
448
|
getBBox(): DOMRect;
|
|
247
449
|
}
|
|
248
450
|
|
|
249
|
-
/**
|
|
250
|
-
* Represents a simplified version of the SVGMatrix.
|
|
251
|
-
*/
|
|
252
|
-
interface ITransformMatrix {
|
|
253
|
-
a: number;
|
|
254
|
-
b: number;
|
|
255
|
-
c: number;
|
|
256
|
-
d: number;
|
|
257
|
-
e: number;
|
|
258
|
-
f: number;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
451
|
/**
|
|
262
452
|
* Represents a state snapshot of a RectangularBoxMarkerBase.
|
|
263
453
|
*/
|
|
@@ -282,13 +472,26 @@ interface RectangularBoxMarkerBaseState extends MarkerBaseState {
|
|
|
282
472
|
* Marker's rotation angle.
|
|
283
473
|
*/
|
|
284
474
|
rotationAngle: number;
|
|
475
|
+
/**
|
|
476
|
+
* Visual transform matrix.
|
|
477
|
+
*
|
|
478
|
+
* Used to correctly position and rotate marker.
|
|
479
|
+
*/
|
|
285
480
|
visualTransformMatrix?: ITransformMatrix;
|
|
481
|
+
/**
|
|
482
|
+
* Container transform matrix.
|
|
483
|
+
*
|
|
484
|
+
* Used to correctly position and rotate marker.
|
|
485
|
+
*/
|
|
286
486
|
containerTransformMatrix?: ITransformMatrix;
|
|
287
487
|
}
|
|
288
488
|
|
|
289
489
|
/**
|
|
290
490
|
* RectangularBoxMarkerBase is a base class for all marker's that conceptually fit into a rectangle
|
|
291
491
|
* such as all rectangle markers, ellipse, text and callout markers.
|
|
492
|
+
*
|
|
493
|
+
* @summary Base class for all markers that conceptually fit into a rectangle.
|
|
494
|
+
* @group Markers
|
|
292
495
|
*/
|
|
293
496
|
declare class RectangularBoxMarkerBase extends MarkerBase {
|
|
294
497
|
/**
|
|
@@ -331,7 +534,14 @@ declare class RectangularBoxMarkerBase extends MarkerBase {
|
|
|
331
534
|
* @param point - coordinates of the new top-left corner of the visual.
|
|
332
535
|
*/
|
|
333
536
|
moveVisual(point: IPoint): void;
|
|
537
|
+
/**
|
|
538
|
+
* Adjusts marker's size.
|
|
539
|
+
*/
|
|
334
540
|
setSize(): void;
|
|
541
|
+
/**
|
|
542
|
+
* Rotates marker around the center.
|
|
543
|
+
* @param point - coordinates of the rotation point.
|
|
544
|
+
*/
|
|
335
545
|
rotate(point: IPoint): void;
|
|
336
546
|
private applyRotation;
|
|
337
547
|
/**
|
|
@@ -344,30 +554,19 @@ declare class RectangularBoxMarkerBase extends MarkerBase {
|
|
|
344
554
|
* @param point - rotated point coordinates.
|
|
345
555
|
*/
|
|
346
556
|
unrotatePoint(point: IPoint): IPoint;
|
|
347
|
-
/**
|
|
348
|
-
* Returns marker's outline path for use while creating, etc.
|
|
349
|
-
* @returns SVG path `d` attribute.
|
|
350
|
-
*/
|
|
351
557
|
getOutline(): string;
|
|
352
|
-
/**
|
|
353
|
-
* Returns marker's state.
|
|
354
|
-
*/
|
|
355
558
|
getState(): RectangularBoxMarkerBaseState;
|
|
356
|
-
/**
|
|
357
|
-
* Restores marker's state to the previously saved one.
|
|
358
|
-
* @param state - previously saved state.
|
|
359
|
-
*/
|
|
360
559
|
restoreState(state: MarkerBaseState): void;
|
|
361
|
-
/**
|
|
362
|
-
* Scales marker. Used after the image resize.
|
|
363
|
-
*
|
|
364
|
-
* @param scaleX - horizontal scale
|
|
365
|
-
* @param scaleY - vertical scale
|
|
366
|
-
*/
|
|
367
560
|
scale(scaleX: number, scaleY: number): void;
|
|
368
561
|
getBBox(): DOMRect;
|
|
369
562
|
}
|
|
370
563
|
|
|
564
|
+
/**
|
|
565
|
+
* Shape outline marker is a base class for all markers that represent a shape outline.
|
|
566
|
+
*
|
|
567
|
+
* @summary Base class for shape outline (unfilled shape) markers.
|
|
568
|
+
* @group Markers
|
|
569
|
+
*/
|
|
371
570
|
declare class ShapeOutlineMarkerBase extends RectangularBoxMarkerBase {
|
|
372
571
|
static title: string;
|
|
373
572
|
protected applyStrokeColor(): void;
|
|
@@ -378,21 +577,17 @@ declare class ShapeOutlineMarkerBase extends RectangularBoxMarkerBase {
|
|
|
378
577
|
ownsTarget(el: EventTarget): boolean;
|
|
379
578
|
protected getPath(width?: number, height?: number): string;
|
|
380
579
|
getOutline(): string;
|
|
381
|
-
createVisual(): void;
|
|
382
|
-
adjustVisual(): void;
|
|
383
|
-
setSize(): void;
|
|
384
580
|
/**
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
* @param state - previously saved state.
|
|
581
|
+
* Creates marker's visual.
|
|
388
582
|
*/
|
|
389
|
-
|
|
583
|
+
createVisual(): void;
|
|
390
584
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
* @param scaleX - horizontal scale
|
|
394
|
-
* @param scaleY - vertical scale
|
|
585
|
+
* Adjusts marker's visual according to the current state
|
|
586
|
+
* (color, width, etc.).
|
|
395
587
|
*/
|
|
588
|
+
adjustVisual(): void;
|
|
589
|
+
setSize(): void;
|
|
590
|
+
restoreState(state: MarkerBaseState): void;
|
|
396
591
|
scale(scaleX: number, scaleY: number): void;
|
|
397
592
|
}
|
|
398
593
|
|
|
@@ -403,42 +598,50 @@ interface ShapeOutlineMarkerBaseState extends RectangularBoxMarkerBaseState {
|
|
|
403
598
|
}
|
|
404
599
|
|
|
405
600
|
/**
|
|
406
|
-
* Represents shape's state.
|
|
601
|
+
* Represents filled shape's state.
|
|
407
602
|
*/
|
|
408
603
|
interface ShapeMarkerBaseState extends ShapeOutlineMarkerBaseState {
|
|
604
|
+
/**
|
|
605
|
+
* Marker's fill color.
|
|
606
|
+
*/
|
|
409
607
|
fillColor: string;
|
|
410
608
|
}
|
|
411
609
|
|
|
610
|
+
/**
|
|
611
|
+
* Base class for filled shape markers.
|
|
612
|
+
*
|
|
613
|
+
* @summary Base class for filled shape markers.
|
|
614
|
+
* @group Markers
|
|
615
|
+
*/
|
|
412
616
|
declare abstract class ShapeMarkerBase extends ShapeOutlineMarkerBase {
|
|
413
617
|
static title: string;
|
|
414
|
-
protected _fillColor: string;
|
|
415
|
-
protected applyFillColor(): void;
|
|
416
|
-
constructor(container: SVGGElement);
|
|
417
|
-
createVisual(): void;
|
|
418
618
|
/**
|
|
419
|
-
*
|
|
619
|
+
* Marker's fill color.
|
|
420
620
|
*/
|
|
421
|
-
|
|
621
|
+
protected _fillColor: string;
|
|
422
622
|
/**
|
|
423
|
-
*
|
|
623
|
+
* Applies the fill color to the marker's visual.
|
|
424
624
|
*
|
|
425
|
-
*
|
|
625
|
+
* If needed, override this method in a derived class to apply the color to the marker's visual.
|
|
426
626
|
*/
|
|
627
|
+
protected applyFillColor(): void;
|
|
628
|
+
constructor(container: SVGGElement);
|
|
629
|
+
createVisual(): void;
|
|
630
|
+
getState(): ShapeMarkerBaseState;
|
|
427
631
|
restoreState(state: MarkerBaseState): void;
|
|
428
632
|
}
|
|
429
633
|
|
|
634
|
+
/**
|
|
635
|
+
* Frame marker represents unfilled rectangle shape.
|
|
636
|
+
*
|
|
637
|
+
* @summary Unfilled rectangle marker.
|
|
638
|
+
* @group Markers
|
|
639
|
+
*/
|
|
430
640
|
declare class FrameMarker extends ShapeOutlineMarkerBase {
|
|
431
|
-
/**
|
|
432
|
-
* String type name of the marker type.
|
|
433
|
-
*/
|
|
434
641
|
static typeName: string;
|
|
435
|
-
/**
|
|
436
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
437
|
-
*/
|
|
438
642
|
static title: string;
|
|
439
643
|
constructor(container: SVGGElement);
|
|
440
644
|
protected getPath(width?: number, height?: number): string;
|
|
441
|
-
getState(): ShapeOutlineMarkerBaseState;
|
|
442
645
|
}
|
|
443
646
|
|
|
444
647
|
/**
|
|
@@ -463,6 +666,14 @@ interface LinearMarkerBaseState extends MarkerBaseState {
|
|
|
463
666
|
y2: number;
|
|
464
667
|
}
|
|
465
668
|
|
|
669
|
+
/**
|
|
670
|
+
* Base class for line-like markers.
|
|
671
|
+
*
|
|
672
|
+
* Use one of the derived classes.
|
|
673
|
+
*
|
|
674
|
+
* @summary Base class for line-like markers.
|
|
675
|
+
* @group Markers
|
|
676
|
+
*/
|
|
466
677
|
declare class LinearMarkerBase extends MarkerBase {
|
|
467
678
|
/**
|
|
468
679
|
* x coordinate of the first end-point
|
|
@@ -484,91 +695,111 @@ declare class LinearMarkerBase extends MarkerBase {
|
|
|
484
695
|
* Marker's main visual.
|
|
485
696
|
*/
|
|
486
697
|
protected visual: SVGGraphicsElement | undefined;
|
|
698
|
+
/**
|
|
699
|
+
* Wider invisible visual to make it easier to select and manipulate the marker.
|
|
700
|
+
*/
|
|
487
701
|
protected selectorVisual: SVGGraphicsElement | undefined;
|
|
702
|
+
/**
|
|
703
|
+
* Visible visual of the marker.
|
|
704
|
+
*/
|
|
488
705
|
protected visibleVisual: SVGGraphicsElement | undefined;
|
|
489
706
|
protected applyStrokeColor(): void;
|
|
490
707
|
protected applyStrokeWidth(): void;
|
|
491
708
|
protected applyStrokeDasharray(): void;
|
|
492
709
|
protected applyOpacity(): void;
|
|
493
710
|
constructor(container: SVGGElement);
|
|
711
|
+
ownsTarget(el: EventTarget): boolean;
|
|
494
712
|
/**
|
|
495
|
-
*
|
|
713
|
+
* The path representing the marker visual.
|
|
496
714
|
*
|
|
497
|
-
*
|
|
715
|
+
* When implemented in derived class should return SVG path for the marker.
|
|
716
|
+
*
|
|
717
|
+
* @returns SVG path for the marker.
|
|
498
718
|
*/
|
|
499
|
-
ownsTarget(el: EventTarget): boolean;
|
|
500
719
|
protected getPath(): string;
|
|
501
|
-
createVisual(): void;
|
|
502
720
|
/**
|
|
503
|
-
*
|
|
721
|
+
* Creates marker's visual.
|
|
504
722
|
*/
|
|
505
|
-
|
|
723
|
+
createVisual(): void;
|
|
506
724
|
/**
|
|
507
|
-
*
|
|
725
|
+
* Adjusts marker visual after manipulation when needed.
|
|
508
726
|
*/
|
|
727
|
+
adjustVisual(): void;
|
|
509
728
|
getState(): LinearMarkerBaseState;
|
|
510
|
-
/**
|
|
511
|
-
* Restores marker's state to the previously saved one.
|
|
512
|
-
* @param state - previously saved state.
|
|
513
|
-
*/
|
|
514
729
|
restoreState(state: MarkerBaseState): void;
|
|
515
|
-
/**
|
|
516
|
-
* Scales marker. Used after the image resize.
|
|
517
|
-
*
|
|
518
|
-
* @param scaleX - horizontal scale
|
|
519
|
-
* @param scaleY - vertical scale
|
|
520
|
-
*/
|
|
521
730
|
scale(scaleX: number, scaleY: number): void;
|
|
522
731
|
}
|
|
523
732
|
|
|
733
|
+
/**
|
|
734
|
+
* Line marker represents a simple straight line.
|
|
735
|
+
*
|
|
736
|
+
* @summary Line marker.
|
|
737
|
+
* @group Markers
|
|
738
|
+
*/
|
|
524
739
|
declare class LineMarker extends LinearMarkerBase {
|
|
525
740
|
static typeName: string;
|
|
526
741
|
static title: string;
|
|
527
742
|
constructor(container: SVGGElement);
|
|
528
743
|
protected getPath(): string;
|
|
529
|
-
/**
|
|
530
|
-
* Returns current marker state that can be restored in the future.
|
|
531
|
-
*/
|
|
532
|
-
getState(): LinearMarkerBaseState;
|
|
533
744
|
}
|
|
534
745
|
|
|
746
|
+
/**
|
|
747
|
+
* Arrow type.
|
|
748
|
+
*
|
|
749
|
+
* Specifies whether the arrow should be drawn at the start, end, both ends or none.
|
|
750
|
+
*/
|
|
535
751
|
type ArrowType = 'both' | 'start' | 'end' | 'none';
|
|
752
|
+
/**
|
|
753
|
+
* Represents the state of the arrow marker.
|
|
754
|
+
*/
|
|
536
755
|
interface ArrowMarkerState extends LinearMarkerBaseState {
|
|
537
756
|
arrowType: ArrowType;
|
|
538
757
|
}
|
|
539
758
|
|
|
759
|
+
/**
|
|
760
|
+
* Arrow marker represents a line with arrow heads at the ends.
|
|
761
|
+
*
|
|
762
|
+
* @summary A line with arrow heads at the ends.
|
|
763
|
+
*
|
|
764
|
+
* @group Markers
|
|
765
|
+
*/
|
|
540
766
|
declare class ArrowMarker extends LineMarker {
|
|
541
767
|
static typeName: string;
|
|
542
768
|
static title: string;
|
|
543
769
|
private _arrowType;
|
|
770
|
+
/**
|
|
771
|
+
* Type of the arrow.
|
|
772
|
+
*
|
|
773
|
+
* Specify whether the arrow should be drawn at the start, end, both ends or none.
|
|
774
|
+
*/
|
|
544
775
|
get arrowType(): ArrowType;
|
|
545
776
|
set arrowType(value: ArrowType);
|
|
546
777
|
constructor(container: SVGGElement);
|
|
547
778
|
protected getPath(): string;
|
|
548
779
|
protected applyStrokeWidth(): void;
|
|
549
|
-
/**
|
|
550
|
-
* Returns marker's state.
|
|
551
|
-
*/
|
|
552
780
|
getState(): ArrowMarkerState;
|
|
553
|
-
/**
|
|
554
|
-
* Restores marker's state to the previously saved one.
|
|
555
|
-
* @param state - previously saved state.
|
|
556
|
-
*/
|
|
557
781
|
restoreState(state: MarkerBaseState): void;
|
|
558
782
|
}
|
|
559
783
|
|
|
784
|
+
/**
|
|
785
|
+
* Represents a measurement marker.
|
|
786
|
+
*
|
|
787
|
+
* Measurement marker is a line with two vertical bars at the ends.
|
|
788
|
+
*
|
|
789
|
+
* @summary A line with two vertical bars at the ends.
|
|
790
|
+
* @group Markers
|
|
791
|
+
*/
|
|
560
792
|
declare class MeasurementMarker extends LineMarker {
|
|
561
793
|
static typeName: string;
|
|
562
794
|
static title: string;
|
|
563
795
|
constructor(container: SVGGElement);
|
|
564
796
|
protected getPath(): string;
|
|
565
797
|
protected applyStrokeWidth(): void;
|
|
566
|
-
/**
|
|
567
|
-
* Returns marker's state.
|
|
568
|
-
*/
|
|
569
|
-
getState(): LinearMarkerBaseState;
|
|
570
798
|
}
|
|
571
799
|
|
|
800
|
+
/**
|
|
801
|
+
* Represents polygon marker's state used to save and restore state.
|
|
802
|
+
*/
|
|
572
803
|
interface PolygonMarkerState extends MarkerBaseState {
|
|
573
804
|
/**
|
|
574
805
|
* Polygon points.
|
|
@@ -576,9 +807,18 @@ interface PolygonMarkerState extends MarkerBaseState {
|
|
|
576
807
|
points: Array<IPoint>;
|
|
577
808
|
}
|
|
578
809
|
|
|
810
|
+
/**
|
|
811
|
+
* Polygon marker is a multi-point marker that represents a polygon.
|
|
812
|
+
*
|
|
813
|
+
* @summary Polygon marker.
|
|
814
|
+
* @group Markers
|
|
815
|
+
*/
|
|
579
816
|
declare class PolygonMarker extends MarkerBase {
|
|
580
817
|
static typeName: string;
|
|
581
818
|
static title: string;
|
|
819
|
+
/**
|
|
820
|
+
* Marker's points.
|
|
821
|
+
*/
|
|
582
822
|
points: IPoint[];
|
|
583
823
|
/**
|
|
584
824
|
* Marker's main visual.
|
|
@@ -592,85 +832,95 @@ declare class PolygonMarker extends MarkerBase {
|
|
|
592
832
|
protected applyStrokeDasharray(): void;
|
|
593
833
|
protected applyOpacity(): void;
|
|
594
834
|
constructor(container: SVGGElement);
|
|
835
|
+
ownsTarget(el: EventTarget): boolean;
|
|
595
836
|
/**
|
|
596
|
-
* Returns
|
|
837
|
+
* Returns SVG path string for the polygon.
|
|
597
838
|
*
|
|
598
|
-
* @
|
|
839
|
+
* @returns Path string for the polygon.
|
|
599
840
|
*/
|
|
600
|
-
ownsTarget(el: EventTarget): boolean;
|
|
601
841
|
protected getPath(): string;
|
|
842
|
+
/**
|
|
843
|
+
* Creates marker's main visual.
|
|
844
|
+
*/
|
|
602
845
|
createVisual(): void;
|
|
846
|
+
/**
|
|
847
|
+
* Creates selector visual.
|
|
848
|
+
*
|
|
849
|
+
* Selector visual is a transparent wider visual that allows easier selection of the marker.
|
|
850
|
+
*/
|
|
603
851
|
private createSelectorVisual;
|
|
604
852
|
/**
|
|
605
|
-
*
|
|
853
|
+
* Adjusts marker visual after manipulation when needed.
|
|
606
854
|
*/
|
|
607
855
|
adjustVisual(): void;
|
|
608
856
|
private adjustSelectorVisual;
|
|
609
857
|
private addSelectorLine;
|
|
610
|
-
/**
|
|
611
|
-
* Returns marker's state.
|
|
612
|
-
*/
|
|
613
858
|
getState(): PolygonMarkerState;
|
|
614
|
-
/**
|
|
615
|
-
* Restores marker's state to the previously saved one.
|
|
616
|
-
* @param state - previously saved state.
|
|
617
|
-
*/
|
|
618
859
|
restoreState(state: MarkerBaseState): void;
|
|
619
|
-
/**
|
|
620
|
-
* Scales marker. Used after the image resize.
|
|
621
|
-
*
|
|
622
|
-
* @param scaleX - horizontal scale
|
|
623
|
-
* @param scaleY - vertical scale
|
|
624
|
-
*/
|
|
625
860
|
scale(scaleX: number, scaleY: number): void;
|
|
626
861
|
}
|
|
627
862
|
|
|
863
|
+
/**
|
|
864
|
+
* Represents the state of a freehand marker.
|
|
865
|
+
*/
|
|
628
866
|
interface FreehandMarkerState extends MarkerBaseState {
|
|
867
|
+
/**
|
|
868
|
+
* Points of the freehand line.
|
|
869
|
+
*/
|
|
629
870
|
points: Array<IPoint>;
|
|
630
871
|
}
|
|
631
872
|
|
|
873
|
+
/**
|
|
874
|
+
* Freehand marker represents a hand drawing.
|
|
875
|
+
*
|
|
876
|
+
* Unlike v2 in v3 freehand marker is represented by an SVG path element.
|
|
877
|
+
* This means that the line properties like stroke color, width, dasharray, etc.
|
|
878
|
+
* can be modified after drawing.
|
|
879
|
+
*
|
|
880
|
+
* @summary Freehand drawing marker.
|
|
881
|
+
* @group Markers
|
|
882
|
+
*/
|
|
632
883
|
declare class FreehandMarker extends MarkerBase {
|
|
633
884
|
static typeName: string;
|
|
634
885
|
static title: string;
|
|
886
|
+
/**
|
|
887
|
+
* Points of the freehand line.
|
|
888
|
+
*/
|
|
635
889
|
points: IPoint[];
|
|
636
890
|
/**
|
|
637
891
|
* Marker's main visual.
|
|
638
892
|
*/
|
|
639
893
|
visual: SVGGraphicsElement | undefined;
|
|
894
|
+
/**
|
|
895
|
+
* Wider invisible visual to make it easier to select and manipulate the marker.
|
|
896
|
+
*/
|
|
640
897
|
protected selectorVisual: SVGGraphicsElement | undefined;
|
|
898
|
+
/**
|
|
899
|
+
* Visible visual of the marker.
|
|
900
|
+
*/
|
|
641
901
|
visibleVisual: SVGGraphicsElement | undefined;
|
|
642
902
|
protected applyStrokeColor(): void;
|
|
643
903
|
protected applyStrokeWidth(): void;
|
|
644
904
|
protected applyStrokeDasharray(): void;
|
|
645
905
|
protected applyOpacity(): void;
|
|
646
906
|
constructor(container: SVGGElement);
|
|
907
|
+
ownsTarget(el: EventTarget): boolean;
|
|
647
908
|
/**
|
|
648
|
-
* Returns
|
|
909
|
+
* Returns SVG path string representing the freehand line.
|
|
649
910
|
*
|
|
650
|
-
* @
|
|
911
|
+
* @returns SVG path string representing the freehand line.
|
|
651
912
|
*/
|
|
652
|
-
ownsTarget(el: EventTarget): boolean;
|
|
653
913
|
protected getPath(): string;
|
|
654
|
-
createVisual(): void;
|
|
655
914
|
/**
|
|
656
|
-
*
|
|
915
|
+
* Creates the visual elements comprising the marker's visual.
|
|
657
916
|
*/
|
|
658
|
-
|
|
917
|
+
createVisual(): void;
|
|
659
918
|
/**
|
|
660
|
-
*
|
|
919
|
+
* Adjusts marker visual after manipulation or with new points.
|
|
661
920
|
*/
|
|
921
|
+
adjustVisual(): void;
|
|
662
922
|
getState(): FreehandMarkerState;
|
|
663
|
-
/**
|
|
664
|
-
* Restores marker's state to the previously saved one.
|
|
665
|
-
* @param state - previously saved state.
|
|
666
|
-
*/
|
|
667
923
|
restoreState(state: MarkerBaseState): void;
|
|
668
|
-
/**
|
|
669
|
-
* Scales marker. Used after the image resize.
|
|
670
|
-
*
|
|
671
|
-
* @param scaleX - horizontal scale
|
|
672
|
-
* @param scaleY - vertical scale
|
|
673
|
-
*/
|
|
674
924
|
scale(scaleX: number, scaleY: number): void;
|
|
675
925
|
}
|
|
676
926
|
|
|
@@ -693,7 +943,7 @@ interface FontSize {
|
|
|
693
943
|
}
|
|
694
944
|
|
|
695
945
|
/**
|
|
696
|
-
* TextBlock represents a block of text used across all text-based
|
|
946
|
+
* TextBlock represents a block of text used across all text-based markers.
|
|
697
947
|
*/
|
|
698
948
|
declare class TextBlock {
|
|
699
949
|
/**
|
|
@@ -704,7 +954,7 @@ declare class TextBlock {
|
|
|
704
954
|
onTextSizeChanged?: (textBlock: TextBlock) => void;
|
|
705
955
|
private _text;
|
|
706
956
|
/**
|
|
707
|
-
* Returns the text block's text
|
|
957
|
+
* Returns the text block's text.
|
|
708
958
|
*/
|
|
709
959
|
get text(): string;
|
|
710
960
|
/**
|
|
@@ -813,57 +1063,86 @@ declare class TextBlock {
|
|
|
813
1063
|
hideControlBox(): void;
|
|
814
1064
|
}
|
|
815
1065
|
|
|
1066
|
+
/**
|
|
1067
|
+
* Represents a state snapshot of a TextMarker.
|
|
1068
|
+
*/
|
|
816
1069
|
interface TextMarkerState extends RectangularBoxMarkerBaseState {
|
|
1070
|
+
/**
|
|
1071
|
+
* Text color.
|
|
1072
|
+
*/
|
|
817
1073
|
color: string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Font family.
|
|
1076
|
+
*/
|
|
818
1077
|
fontFamily: string;
|
|
1078
|
+
/**
|
|
1079
|
+
* Font size.
|
|
1080
|
+
*/
|
|
819
1081
|
fontSize: FontSize;
|
|
1082
|
+
/**
|
|
1083
|
+
* Text content.
|
|
1084
|
+
*/
|
|
820
1085
|
text: string;
|
|
821
1086
|
}
|
|
822
1087
|
|
|
1088
|
+
/**
|
|
1089
|
+
* Text marker.
|
|
1090
|
+
*
|
|
1091
|
+
* Used to represent a text block as well a base class for other text-based markers.
|
|
1092
|
+
*
|
|
1093
|
+
* @summary Text marker.
|
|
1094
|
+
* @group Markers
|
|
1095
|
+
*/
|
|
823
1096
|
declare class TextMarker extends RectangularBoxMarkerBase {
|
|
824
1097
|
static typeName: string;
|
|
825
1098
|
static title: string;
|
|
1099
|
+
/**
|
|
1100
|
+
* Default text for the marker type.
|
|
1101
|
+
*/
|
|
826
1102
|
protected static DEFAULT_TEXT: string;
|
|
1103
|
+
/**
|
|
1104
|
+
* Callback to be called when the text size changes.
|
|
1105
|
+
*/
|
|
827
1106
|
onSizeChanged?: (textMarker: TextMarker) => void;
|
|
828
1107
|
private _color;
|
|
829
1108
|
/**
|
|
830
|
-
* Returns
|
|
1109
|
+
* Returns markers's text color.
|
|
831
1110
|
*/
|
|
832
1111
|
get color(): string;
|
|
833
1112
|
/**
|
|
834
|
-
* Sets the
|
|
1113
|
+
* Sets the markers's text color.
|
|
835
1114
|
*/
|
|
836
1115
|
set color(value: string);
|
|
837
1116
|
private _fontFamily;
|
|
838
1117
|
/**
|
|
839
|
-
* Returns the
|
|
1118
|
+
* Returns the markers's font family.
|
|
840
1119
|
*/
|
|
841
1120
|
get fontFamily(): string;
|
|
842
1121
|
/**
|
|
843
|
-
* Sets the
|
|
1122
|
+
* Sets the markers's font family.
|
|
844
1123
|
*/
|
|
845
1124
|
set fontFamily(value: string);
|
|
846
1125
|
private _fontSize;
|
|
847
1126
|
/**
|
|
848
|
-
* Returns the
|
|
1127
|
+
* Returns the marker's font size.
|
|
849
1128
|
*/
|
|
850
1129
|
get fontSize(): FontSize;
|
|
851
1130
|
/**
|
|
852
|
-
* Sets the
|
|
1131
|
+
* Sets the marker's font size.
|
|
853
1132
|
*/
|
|
854
1133
|
set fontSize(value: FontSize);
|
|
855
1134
|
/**
|
|
856
|
-
* Returns the default text for the
|
|
857
|
-
* @returns
|
|
1135
|
+
* Returns the default text for the marker type.
|
|
1136
|
+
* @returns marker type's default text.
|
|
858
1137
|
*/
|
|
859
1138
|
protected getDefaultText(): string;
|
|
860
1139
|
private _text;
|
|
861
1140
|
/**
|
|
862
|
-
* Returns the
|
|
1141
|
+
* Returns the marker's text.
|
|
863
1142
|
*/
|
|
864
1143
|
get text(): string;
|
|
865
1144
|
/**
|
|
866
|
-
* Sets the
|
|
1145
|
+
* Sets the marker's text.
|
|
867
1146
|
*/
|
|
868
1147
|
set text(value: string);
|
|
869
1148
|
/**
|
|
@@ -879,14 +1158,26 @@ declare class TextMarker extends RectangularBoxMarkerBase {
|
|
|
879
1158
|
*/
|
|
880
1159
|
textBlock: TextBlock;
|
|
881
1160
|
constructor(container: SVGGElement);
|
|
1161
|
+
/**
|
|
1162
|
+
* Creates marker's visual.
|
|
1163
|
+
*/
|
|
882
1164
|
createVisual(): void;
|
|
1165
|
+
/**
|
|
1166
|
+
* Adjusts marker's visual according to the current state.
|
|
1167
|
+
*/
|
|
883
1168
|
adjustVisual(): void;
|
|
884
1169
|
ownsTarget(el: EventTarget): boolean;
|
|
1170
|
+
/**
|
|
1171
|
+
* Sets the text bounding box.
|
|
1172
|
+
*/
|
|
885
1173
|
protected setTextBoundingBox(): void;
|
|
886
1174
|
/**
|
|
887
|
-
* Sets (adjusts) the
|
|
1175
|
+
* Sets (adjusts) the marker's size.
|
|
888
1176
|
*/
|
|
889
1177
|
setSize(): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Sets the marker's size based on the text size.
|
|
1180
|
+
*/
|
|
890
1181
|
protected setSizeFromTextSize(): void;
|
|
891
1182
|
private textSizeChanged;
|
|
892
1183
|
/**
|
|
@@ -904,54 +1195,77 @@ declare class TextMarker extends RectangularBoxMarkerBase {
|
|
|
904
1195
|
* @param fontSize font size
|
|
905
1196
|
*/
|
|
906
1197
|
setFontSize(fontSize: FontSize): void;
|
|
1198
|
+
/**
|
|
1199
|
+
* Hides the marker's visual.
|
|
1200
|
+
*
|
|
1201
|
+
* Used when editing the text.
|
|
1202
|
+
*/
|
|
907
1203
|
hideVisual(): void;
|
|
908
|
-
showVisual(): void;
|
|
909
|
-
getState(): TextMarkerState;
|
|
910
1204
|
/**
|
|
911
|
-
*
|
|
1205
|
+
* Shows the marker's visual.
|
|
912
1206
|
*
|
|
913
|
-
*
|
|
1207
|
+
* Eg. when done editing the text.
|
|
914
1208
|
*/
|
|
1209
|
+
showVisual(): void;
|
|
1210
|
+
getState(): TextMarkerState;
|
|
915
1211
|
restoreState(state: MarkerBaseState): void;
|
|
916
1212
|
scale(scaleX: number, scaleY: number): void;
|
|
917
1213
|
}
|
|
918
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* Cover marker is a filled rectangle marker.
|
|
1217
|
+
*
|
|
1218
|
+
* A typical use case is to cover some area of the image with a colored rectangle as a "redaction".
|
|
1219
|
+
*
|
|
1220
|
+
* @summary Filled rectangle marker.
|
|
1221
|
+
* @group Markers
|
|
1222
|
+
*/
|
|
919
1223
|
declare class CoverMarker extends ShapeMarkerBase {
|
|
920
|
-
/**
|
|
921
|
-
* String type name of the marker type.
|
|
922
|
-
*/
|
|
923
1224
|
static typeName: string;
|
|
924
|
-
/**
|
|
925
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
926
|
-
*/
|
|
927
1225
|
static title: string;
|
|
928
1226
|
constructor(container: SVGGElement);
|
|
929
1227
|
protected getPath(width?: number, height?: number): string;
|
|
930
|
-
getState(): ShapeMarkerBaseState;
|
|
931
1228
|
}
|
|
932
1229
|
|
|
1230
|
+
/**
|
|
1231
|
+
* Highlight marker is a semi-transparent rectangular marker.
|
|
1232
|
+
*
|
|
1233
|
+
* @summary Semi-transparent rectangular marker.
|
|
1234
|
+
* @group Markers
|
|
1235
|
+
*/
|
|
933
1236
|
declare class HighlightMarker extends ShapeMarkerBase {
|
|
934
|
-
/**
|
|
935
|
-
* String type name of the marker type.
|
|
936
|
-
*/
|
|
937
1237
|
static typeName: string;
|
|
938
|
-
/**
|
|
939
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
940
|
-
*/
|
|
941
1238
|
static title: string;
|
|
942
1239
|
constructor(container: SVGGElement);
|
|
943
1240
|
protected getPath(width?: number, height?: number): string;
|
|
944
|
-
getState(): ShapeMarkerBaseState;
|
|
945
1241
|
}
|
|
946
1242
|
|
|
1243
|
+
/**
|
|
1244
|
+
* Represents the state of a callout marker.
|
|
1245
|
+
*/
|
|
947
1246
|
interface CalloutMarkerState extends TextMarkerState {
|
|
1247
|
+
/**
|
|
1248
|
+
* Coordinates of the position of the tip of the callout.
|
|
1249
|
+
*/
|
|
948
1250
|
tipPosition: IPoint;
|
|
949
1251
|
}
|
|
950
1252
|
|
|
1253
|
+
/**
|
|
1254
|
+
* Callout marker is a text-based marker with a callout outline with a tip that can point to specific place
|
|
1255
|
+
* on the underlying image or annotation.
|
|
1256
|
+
*
|
|
1257
|
+
* @summary Text-based marker with a callout outline with a tip that can point to specific place
|
|
1258
|
+
* on the underlying image or annotation.
|
|
1259
|
+
*
|
|
1260
|
+
* @group Markers
|
|
1261
|
+
*/
|
|
951
1262
|
declare class CalloutMarker extends TextMarker {
|
|
952
1263
|
static typeName: string;
|
|
953
1264
|
static title: string;
|
|
954
1265
|
private _tipPosition;
|
|
1266
|
+
/**
|
|
1267
|
+
* Coordinates of the position of the tip of the callout.
|
|
1268
|
+
*/
|
|
955
1269
|
get tipPosition(): IPoint;
|
|
956
1270
|
set tipPosition(value: IPoint);
|
|
957
1271
|
private tipBase1Position;
|
|
@@ -963,6 +1277,11 @@ declare class CalloutMarker extends TextMarker {
|
|
|
963
1277
|
protected applyStrokeDasharray(): void;
|
|
964
1278
|
protected applyOpacity(): void;
|
|
965
1279
|
protected applyFillColor(): void;
|
|
1280
|
+
/**
|
|
1281
|
+
* Returns the SVG path string for the callout outline.
|
|
1282
|
+
*
|
|
1283
|
+
* @returns Path string for the callout outline.
|
|
1284
|
+
*/
|
|
966
1285
|
protected getPath(): string;
|
|
967
1286
|
private setTipPoints;
|
|
968
1287
|
createVisual(): void;
|
|
@@ -973,55 +1292,98 @@ declare class CalloutMarker extends TextMarker {
|
|
|
973
1292
|
scale(scaleX: number, scaleY: number): void;
|
|
974
1293
|
}
|
|
975
1294
|
|
|
1295
|
+
/**
|
|
1296
|
+
* Ellipse frame marker represents unfilled circle/ellipse shape.
|
|
1297
|
+
*
|
|
1298
|
+
* @summary Unfilled ellipse marker.
|
|
1299
|
+
* @group Markers
|
|
1300
|
+
*/
|
|
976
1301
|
declare class EllipseFrameMarker extends ShapeOutlineMarkerBase {
|
|
977
|
-
/**
|
|
978
|
-
* String type name of the marker type.
|
|
979
|
-
*/
|
|
980
1302
|
static typeName: string;
|
|
981
|
-
/**
|
|
982
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
983
|
-
*/
|
|
984
1303
|
static title: string;
|
|
985
1304
|
constructor(container: SVGGElement);
|
|
986
1305
|
protected getPath(width?: number, height?: number): string;
|
|
987
|
-
getState(): ShapeOutlineMarkerBaseState;
|
|
988
1306
|
}
|
|
989
1307
|
|
|
1308
|
+
/**
|
|
1309
|
+
* Ellipse marker is a filled ellipse marker.
|
|
1310
|
+
*
|
|
1311
|
+
* @summary Filled ellipse marker.
|
|
1312
|
+
* @group Markers
|
|
1313
|
+
*/
|
|
990
1314
|
declare class EllipseMarker extends ShapeMarkerBase {
|
|
991
|
-
/**
|
|
992
|
-
* String type name of the marker type.
|
|
993
|
-
*/
|
|
994
1315
|
static typeName: string;
|
|
995
|
-
/**
|
|
996
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
997
|
-
*/
|
|
998
1316
|
static title: string;
|
|
999
1317
|
constructor(container: SVGGElement);
|
|
1000
1318
|
protected getPath(width?: number, height?: number): string;
|
|
1001
|
-
getState(): ShapeMarkerBaseState;
|
|
1002
1319
|
}
|
|
1003
1320
|
|
|
1321
|
+
/**
|
|
1322
|
+
* The type of image (svg or bitmap).
|
|
1323
|
+
*
|
|
1324
|
+
* Used in {@link Core!ImageMarkerBase | ImageMarkerBase } and its descendants.
|
|
1325
|
+
*/
|
|
1004
1326
|
type ImageType = 'svg' | 'bitmap';
|
|
1005
1327
|
/**
|
|
1006
1328
|
* Represents image marker's state.
|
|
1007
1329
|
*/
|
|
1008
1330
|
interface ImageMarkerBaseState extends RectangularBoxMarkerBaseState {
|
|
1331
|
+
/**
|
|
1332
|
+
* Type of the image: SVG or bitmap.
|
|
1333
|
+
*/
|
|
1009
1334
|
imageType?: ImageType;
|
|
1335
|
+
/**
|
|
1336
|
+
* SVG markup of the SVG image.
|
|
1337
|
+
*/
|
|
1010
1338
|
svgString?: string;
|
|
1339
|
+
/**
|
|
1340
|
+
* Image source (URL or base64 encoded image).
|
|
1341
|
+
*/
|
|
1011
1342
|
imageSrc?: string;
|
|
1012
1343
|
}
|
|
1013
1344
|
|
|
1345
|
+
/**
|
|
1346
|
+
* Base class for image markers.
|
|
1347
|
+
*
|
|
1348
|
+
* This class isn't meant to be used directly. Use one of the derived classes instead.
|
|
1349
|
+
*
|
|
1350
|
+
* @summary Image marker base class.
|
|
1351
|
+
* @group Markers
|
|
1352
|
+
*/
|
|
1014
1353
|
declare class ImageMarkerBase extends RectangularBoxMarkerBase {
|
|
1015
1354
|
static title: string;
|
|
1016
1355
|
/**
|
|
1017
|
-
* Main SVG or image element of the
|
|
1356
|
+
* Main SVG or image element of the marker.
|
|
1018
1357
|
*/
|
|
1019
1358
|
protected SVGImage?: SVGSVGElement | SVGImageElement;
|
|
1359
|
+
/**
|
|
1360
|
+
* Type of the image: SVG or bitmap.
|
|
1361
|
+
*/
|
|
1020
1362
|
protected imageType: ImageType;
|
|
1363
|
+
/**
|
|
1364
|
+
* For SVG images this holds the SVG markup of the image.
|
|
1365
|
+
*/
|
|
1021
1366
|
protected _svgString?: string;
|
|
1367
|
+
/**
|
|
1368
|
+
* For SVG images this holds the SVG markup of the image.
|
|
1369
|
+
*/
|
|
1022
1370
|
get svgString(): string | undefined;
|
|
1023
1371
|
set svgString(value: string | undefined);
|
|
1372
|
+
/**
|
|
1373
|
+
* For bitmap images this holds the base64 encoded image.
|
|
1374
|
+
*/
|
|
1024
1375
|
protected _imageSrc?: string;
|
|
1376
|
+
/**
|
|
1377
|
+
* For bitmap images this holds the base64 encoded image.
|
|
1378
|
+
*
|
|
1379
|
+
* @remarks
|
|
1380
|
+
* Technically this could be any URL but due to browser security constraints
|
|
1381
|
+
* an external image will almost certainly cause bitmap rendering of the image to fail.
|
|
1382
|
+
*
|
|
1383
|
+
* In cases you know you will never render the annotation as a static image,
|
|
1384
|
+
* it should be safe to use external URLs. Otherwise, use base64 encoded images
|
|
1385
|
+
* like 'data:image/png;base64,...'.
|
|
1386
|
+
*/
|
|
1025
1387
|
get imageSrc(): string | undefined;
|
|
1026
1388
|
set imageSrc(value: string | undefined);
|
|
1027
1389
|
/**
|
|
@@ -1033,8 +1395,17 @@ declare class ImageMarkerBase extends RectangularBoxMarkerBase {
|
|
|
1033
1395
|
*/
|
|
1034
1396
|
protected naturalHeight: number;
|
|
1035
1397
|
constructor(container: SVGGElement);
|
|
1398
|
+
/**
|
|
1399
|
+
* Creates the image element based on the image type and source.
|
|
1400
|
+
*/
|
|
1036
1401
|
protected createImage(): void;
|
|
1402
|
+
/**
|
|
1403
|
+
* Creates marker's visual, including its image element.
|
|
1404
|
+
*/
|
|
1037
1405
|
createVisual(): void;
|
|
1406
|
+
/**
|
|
1407
|
+
* Adjusts the image size and position.
|
|
1408
|
+
*/
|
|
1038
1409
|
adjustImage(): void;
|
|
1039
1410
|
private isDescendant;
|
|
1040
1411
|
ownsTarget(el: EventTarget): boolean;
|
|
@@ -1042,62 +1413,63 @@ declare class ImageMarkerBase extends RectangularBoxMarkerBase {
|
|
|
1042
1413
|
getState(): ImageMarkerBaseState;
|
|
1043
1414
|
protected applyStrokeColor(): void;
|
|
1044
1415
|
restoreState(state: ImageMarkerBaseState): void;
|
|
1045
|
-
/**
|
|
1046
|
-
* Scales marker. Used after the image resize.
|
|
1047
|
-
*
|
|
1048
|
-
* @param scaleX - horizontal scale
|
|
1049
|
-
* @param scaleY - vertical scale
|
|
1050
|
-
*/
|
|
1051
1416
|
scale(scaleX: number, scaleY: number): void;
|
|
1052
1417
|
}
|
|
1053
1418
|
|
|
1054
1419
|
/**
|
|
1055
1420
|
* Used to represent user-set images.
|
|
1421
|
+
*
|
|
1422
|
+
* Use this marker to display custom images at runtime.
|
|
1423
|
+
* For example, you can use this type to represent emojis selected in an emoji picker.
|
|
1424
|
+
*
|
|
1425
|
+
* @summary Custom image marker.
|
|
1426
|
+
* @group Markers
|
|
1056
1427
|
*/
|
|
1057
1428
|
declare class CustomImageMarker extends ImageMarkerBase {
|
|
1058
|
-
/**
|
|
1059
|
-
* String type name of the marker type.
|
|
1060
|
-
*/
|
|
1061
1429
|
static typeName: string;
|
|
1062
|
-
/**
|
|
1063
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
1064
|
-
*/
|
|
1065
1430
|
static title: string;
|
|
1066
1431
|
}
|
|
1067
1432
|
|
|
1068
1433
|
/**
|
|
1069
1434
|
* Check mark marker.
|
|
1435
|
+
*
|
|
1436
|
+
* Represents a check mark image marker. Can be used to quickly mark something as correct, or
|
|
1437
|
+
* similar use cases.
|
|
1438
|
+
*
|
|
1439
|
+
* @summary Check mark image marker.
|
|
1440
|
+
* @group Markers
|
|
1070
1441
|
*/
|
|
1071
1442
|
declare class CheckImageMarker extends ImageMarkerBase {
|
|
1072
|
-
/**
|
|
1073
|
-
* String type name of the marker type.
|
|
1074
|
-
*/
|
|
1075
1443
|
static typeName: string;
|
|
1076
|
-
/**
|
|
1077
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
1078
|
-
*/
|
|
1079
1444
|
static title: string;
|
|
1080
1445
|
constructor(container: SVGGElement);
|
|
1081
1446
|
}
|
|
1082
1447
|
|
|
1083
1448
|
/**
|
|
1084
|
-
* X mark marker.
|
|
1449
|
+
* X mark image marker.
|
|
1450
|
+
*
|
|
1451
|
+
* @summary X (crossed) image marker.
|
|
1452
|
+
* @group Markers
|
|
1085
1453
|
*/
|
|
1086
1454
|
declare class XImageMarker extends ImageMarkerBase {
|
|
1087
|
-
/**
|
|
1088
|
-
* String type name of the marker type.
|
|
1089
|
-
*/
|
|
1090
1455
|
static typeName: string;
|
|
1091
|
-
/**
|
|
1092
|
-
* Marker type title (display name) used for accessibility and other attributes.
|
|
1093
|
-
*/
|
|
1094
1456
|
static title: string;
|
|
1095
1457
|
constructor(container: SVGGElement);
|
|
1096
1458
|
}
|
|
1097
1459
|
|
|
1460
|
+
/**
|
|
1461
|
+
* Represents the state of a caption frame marker.
|
|
1462
|
+
*/
|
|
1098
1463
|
interface CaptionFrameMarkerState extends TextMarkerState, ShapeMarkerBaseState {
|
|
1099
1464
|
}
|
|
1100
1465
|
|
|
1466
|
+
/**
|
|
1467
|
+
* Caption frame marker is a combination of a frame (rectangle) and a text caption that goes with it.
|
|
1468
|
+
*
|
|
1469
|
+
* @summary A combination of a frame (rectangle) and a text caption that goes with it.
|
|
1470
|
+
*
|
|
1471
|
+
* @group Markers
|
|
1472
|
+
*/
|
|
1101
1473
|
declare class CaptionFrameMarker extends TextMarker {
|
|
1102
1474
|
static typeName: string;
|
|
1103
1475
|
static title: string;
|
|
@@ -1110,30 +1482,50 @@ declare class CaptionFrameMarker extends TextMarker {
|
|
|
1110
1482
|
protected applyStrokeDasharray(): void;
|
|
1111
1483
|
protected applyOpacity(): void;
|
|
1112
1484
|
protected applyFillColor(): void;
|
|
1485
|
+
/**
|
|
1486
|
+
* Returns the SVG path strings for the frame and the caption background.
|
|
1487
|
+
*
|
|
1488
|
+
* @param width
|
|
1489
|
+
* @param height
|
|
1490
|
+
* @returns SVG path strings for the frame and the caption background.
|
|
1491
|
+
*/
|
|
1113
1492
|
protected getPaths(width?: number, height?: number): {
|
|
1114
1493
|
frame: string;
|
|
1115
1494
|
caption: string;
|
|
1116
1495
|
};
|
|
1117
1496
|
createVisual(): void;
|
|
1118
1497
|
adjustVisual(): void;
|
|
1498
|
+
/**
|
|
1499
|
+
* Adjusts text position inside the caption frame.
|
|
1500
|
+
*/
|
|
1119
1501
|
protected adjustTextPosition(): void;
|
|
1502
|
+
/**
|
|
1503
|
+
* Adjusts frame visual according to the current marker properties.
|
|
1504
|
+
*/
|
|
1120
1505
|
protected adjustFrameVisual(): void;
|
|
1121
1506
|
ownsTarget(el: EventTarget): boolean;
|
|
1122
1507
|
setSize(): void;
|
|
1123
1508
|
protected setSizeFromTextSize(): void;
|
|
1509
|
+
/**
|
|
1510
|
+
* Hides the marker visual.
|
|
1511
|
+
*
|
|
1512
|
+
* Used by the editor to hide rendered marker while editing the text.
|
|
1513
|
+
*/
|
|
1124
1514
|
hideVisual(): void;
|
|
1125
|
-
showVisual(): void;
|
|
1126
|
-
getState(): CaptionFrameMarkerState;
|
|
1127
|
-
restoreState(state: MarkerBaseState): void;
|
|
1128
1515
|
/**
|
|
1129
|
-
*
|
|
1516
|
+
* Shows the marker visual.
|
|
1130
1517
|
*
|
|
1131
|
-
*
|
|
1132
|
-
* @param scaleY - vertical scale
|
|
1518
|
+
* Used by the editor to show rendered marker after editing the text.
|
|
1133
1519
|
*/
|
|
1520
|
+
showVisual(): void;
|
|
1521
|
+
getState(): CaptionFrameMarkerState;
|
|
1522
|
+
restoreState(state: MarkerBaseState): void;
|
|
1134
1523
|
scale(scaleX: number, scaleY: number): void;
|
|
1135
1524
|
}
|
|
1136
1525
|
|
|
1526
|
+
/**
|
|
1527
|
+
* Properties for marker editor.
|
|
1528
|
+
*/
|
|
1137
1529
|
interface MarkerEditorProperties<TMarkerType extends MarkerBase = MarkerBase> {
|
|
1138
1530
|
/**
|
|
1139
1531
|
* SVG container for the marker and editor elements.
|
|
@@ -1157,19 +1549,56 @@ interface MarkerEditorProperties<TMarkerType extends MarkerBase = MarkerBase> {
|
|
|
1157
1549
|
* Represents marker's state (status) in time.
|
|
1158
1550
|
*/
|
|
1159
1551
|
type MarkerEditorState = 'new' | 'creating' | 'select' | 'move' | 'resize' | 'rotate' | 'edit';
|
|
1552
|
+
/**
|
|
1553
|
+
* Marker creation style defines whether markers are created by drawing them or just dropping them on the canvas.
|
|
1554
|
+
*/
|
|
1160
1555
|
type MarkerCreationStyle = 'draw' | 'drop';
|
|
1556
|
+
/**
|
|
1557
|
+
* Base class for all marker editors.
|
|
1558
|
+
*
|
|
1559
|
+
* @typeParam TMarkerType - marker type the instance of the editor is for.
|
|
1560
|
+
*
|
|
1561
|
+
* @summary Base class for all marker editors.
|
|
1562
|
+
* @group Editors
|
|
1563
|
+
*/
|
|
1161
1564
|
declare class MarkerBaseEditor<TMarkerType extends MarkerBase = MarkerBase> {
|
|
1565
|
+
/**
|
|
1566
|
+
* Marker type constructor.
|
|
1567
|
+
*/
|
|
1162
1568
|
protected _markerType: new (container: SVGGElement) => TMarkerType;
|
|
1569
|
+
/**
|
|
1570
|
+
* Marker creation style.
|
|
1571
|
+
*
|
|
1572
|
+
* Markers can either be created by drawing them or just dropping them on the canvas.
|
|
1573
|
+
*/
|
|
1163
1574
|
protected _creationStyle: MarkerCreationStyle;
|
|
1575
|
+
/**
|
|
1576
|
+
* Marker creation style.
|
|
1577
|
+
*
|
|
1578
|
+
* Markers can either be created by drawing them or just dropping them on the canvas.
|
|
1579
|
+
*/
|
|
1164
1580
|
get creationStyle(): MarkerCreationStyle;
|
|
1165
1581
|
/**
|
|
1166
1582
|
* Type guard for specific marker editor types.
|
|
1583
|
+
*
|
|
1584
|
+
* This allows to check if the editor is of a specific type which is useful for displaying type-specific UI.
|
|
1585
|
+
*
|
|
1586
|
+
* @typeParam T - specific marker editor type.
|
|
1167
1587
|
* @param cls
|
|
1168
1588
|
* @returns
|
|
1169
1589
|
*/
|
|
1170
1590
|
is<T>(cls: new (...args: any[]) => T): this is T;
|
|
1591
|
+
/**
|
|
1592
|
+
* Marker instance.
|
|
1593
|
+
*/
|
|
1171
1594
|
protected _marker: TMarkerType;
|
|
1595
|
+
/**
|
|
1596
|
+
* Returns the marker instance.
|
|
1597
|
+
*/
|
|
1172
1598
|
get marker(): TMarkerType;
|
|
1599
|
+
/**
|
|
1600
|
+
* SVG container for the marker's and editor's visual elements.
|
|
1601
|
+
*/
|
|
1173
1602
|
protected _container: SVGGElement;
|
|
1174
1603
|
/**
|
|
1175
1604
|
* Returns the SVG container for the marker's and editor's visual elements.
|
|
@@ -1219,32 +1648,73 @@ declare class MarkerBaseEditor<TMarkerType extends MarkerBase = MarkerBase> {
|
|
|
1219
1648
|
* Returns true if the marker is currently selected
|
|
1220
1649
|
*/
|
|
1221
1650
|
get isSelected(): boolean;
|
|
1651
|
+
/**
|
|
1652
|
+
* When set to true, a new marker of the same type is created immediately after the current one is finished.
|
|
1653
|
+
*/
|
|
1222
1654
|
protected _continuousCreation: boolean;
|
|
1655
|
+
/**
|
|
1656
|
+
* When set to true, a new marker of the same type is created immediately after the current one is finished.
|
|
1657
|
+
*/
|
|
1223
1658
|
get continuousCreation(): boolean;
|
|
1224
1659
|
/**
|
|
1225
|
-
* Sets
|
|
1660
|
+
* Sets marker's stroke (outline) color.
|
|
1226
1661
|
* @param color - color as string
|
|
1227
1662
|
*/
|
|
1228
1663
|
set strokeColor(color: string);
|
|
1664
|
+
/**
|
|
1665
|
+
* Gets marker's stroke (outline) color.
|
|
1666
|
+
*/
|
|
1229
1667
|
get strokeColor(): string;
|
|
1230
1668
|
/**
|
|
1231
|
-
* Sets
|
|
1232
|
-
* @param
|
|
1669
|
+
* Sets marker's stroke (outline) width.
|
|
1670
|
+
* @param width - stroke width in pixels.
|
|
1233
1671
|
*/
|
|
1234
1672
|
set strokeWidth(width: number);
|
|
1673
|
+
/**
|
|
1674
|
+
* Gets marker's stroke (outline) width.
|
|
1675
|
+
*/
|
|
1235
1676
|
get strokeWidth(): number;
|
|
1236
1677
|
/**
|
|
1237
|
-
* Sets
|
|
1238
|
-
* @param
|
|
1678
|
+
* Sets marker's stroke (outline) dash array.
|
|
1679
|
+
* @param dashes - dash array as string
|
|
1239
1680
|
*/
|
|
1240
1681
|
set strokeDasharray(dashes: string);
|
|
1682
|
+
/**
|
|
1683
|
+
* Gets marker's stroke (outline) dash array.
|
|
1684
|
+
*/
|
|
1241
1685
|
get strokeDasharray(): string;
|
|
1686
|
+
/**
|
|
1687
|
+
* Sets marker's fill color.
|
|
1688
|
+
*/
|
|
1242
1689
|
set fillColor(color: string);
|
|
1690
|
+
/**
|
|
1691
|
+
* Gets marker's fill color.
|
|
1692
|
+
*/
|
|
1243
1693
|
get fillColor(): string;
|
|
1694
|
+
/**
|
|
1695
|
+
* Sets marker's opacity.
|
|
1696
|
+
*/
|
|
1244
1697
|
set opacity(value: number);
|
|
1698
|
+
/**
|
|
1699
|
+
* Gets marker's opacity.
|
|
1700
|
+
*/
|
|
1245
1701
|
get opacity(): number;
|
|
1702
|
+
/**
|
|
1703
|
+
* Creates a new instance of marker editor.
|
|
1704
|
+
*
|
|
1705
|
+
* @param properties - marker editor properties.
|
|
1706
|
+
*/
|
|
1246
1707
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
1708
|
+
/**
|
|
1709
|
+
* Returns true if the marker or the editor owns supplied target element.
|
|
1710
|
+
*
|
|
1711
|
+
* @param el target element
|
|
1712
|
+
* @returns
|
|
1713
|
+
*/
|
|
1247
1714
|
ownsTarget(el: EventTarget | null): boolean;
|
|
1715
|
+
/**
|
|
1716
|
+
* Is this marker selected in a multi-selection?
|
|
1717
|
+
*/
|
|
1248
1718
|
protected isMultiSelected: boolean;
|
|
1249
1719
|
/**
|
|
1250
1720
|
* Selects this marker and displays appropriate selected marker UI.
|
|
@@ -1284,13 +1754,27 @@ declare class MarkerBaseEditor<TMarkerType extends MarkerBase = MarkerBase> {
|
|
|
1284
1754
|
* Disposes the marker and clean's up.
|
|
1285
1755
|
*/
|
|
1286
1756
|
dispose(): void;
|
|
1757
|
+
/**
|
|
1758
|
+
* Adjusts marker's control box.
|
|
1759
|
+
*/
|
|
1287
1760
|
protected adjustControlBox(): void;
|
|
1761
|
+
/**
|
|
1762
|
+
* Scales the marker and the editor.
|
|
1763
|
+
*
|
|
1764
|
+
* @param scaleX
|
|
1765
|
+
* @param scaleY
|
|
1766
|
+
*/
|
|
1288
1767
|
scale(scaleX: number, scaleY: number): void;
|
|
1289
1768
|
/**
|
|
1290
1769
|
* Called by a marker when its state could have changed.
|
|
1291
1770
|
* Does a check if the state has indeed changed before firing the handler.
|
|
1292
1771
|
*/
|
|
1293
1772
|
protected stateChanged(): void;
|
|
1773
|
+
/**
|
|
1774
|
+
* Returns marker's state that can be restored in the future.
|
|
1775
|
+
*
|
|
1776
|
+
* @returns
|
|
1777
|
+
*/
|
|
1294
1778
|
getState(): MarkerBaseState;
|
|
1295
1779
|
/**
|
|
1296
1780
|
* Restores previously saved marker state.
|
|
@@ -1300,33 +1784,129 @@ declare class MarkerBaseEditor<TMarkerType extends MarkerBase = MarkerBase> {
|
|
|
1300
1784
|
restoreState(state: MarkerBaseState): void;
|
|
1301
1785
|
}
|
|
1302
1786
|
|
|
1787
|
+
/**
|
|
1788
|
+
* Marker area custom event types.
|
|
1789
|
+
*/
|
|
1303
1790
|
interface MarkerAreaEventMap {
|
|
1304
1791
|
/**
|
|
1305
1792
|
* Marker area initialized.
|
|
1306
1793
|
*/
|
|
1307
1794
|
areainit: CustomEvent<MarkerAreaEventData>;
|
|
1795
|
+
/**
|
|
1796
|
+
* Marker area shown.
|
|
1797
|
+
*/
|
|
1308
1798
|
areashow: CustomEvent<MarkerAreaEventData>;
|
|
1799
|
+
/**
|
|
1800
|
+
* Marker area state restored.
|
|
1801
|
+
*/
|
|
1309
1802
|
arearestorestate: CustomEvent<MarkerAreaEventData>;
|
|
1803
|
+
/**
|
|
1804
|
+
* Marker area focused.
|
|
1805
|
+
*/
|
|
1310
1806
|
areafocus: CustomEvent<MarkerAreaEventData>;
|
|
1807
|
+
/**
|
|
1808
|
+
* Marker area lost focus.
|
|
1809
|
+
*/
|
|
1311
1810
|
areablur: CustomEvent<MarkerAreaEventData>;
|
|
1811
|
+
/**
|
|
1812
|
+
* Marker area state changed.
|
|
1813
|
+
*/
|
|
1312
1814
|
areastatechange: CustomEvent<MarkerAreaEventData>;
|
|
1815
|
+
/**
|
|
1816
|
+
* Marker selected.
|
|
1817
|
+
*/
|
|
1313
1818
|
markerselect: CustomEvent<MarkerEditorEventData>;
|
|
1819
|
+
/**
|
|
1820
|
+
* Marker deselected.
|
|
1821
|
+
*/
|
|
1314
1822
|
markerdeselect: CustomEvent<MarkerEditorEventData>;
|
|
1823
|
+
/**
|
|
1824
|
+
* Marker creating.
|
|
1825
|
+
*/
|
|
1315
1826
|
markercreating: CustomEvent<MarkerEditorEventData>;
|
|
1827
|
+
/**
|
|
1828
|
+
* Marker created.
|
|
1829
|
+
*/
|
|
1316
1830
|
markercreate: CustomEvent<MarkerEditorEventData>;
|
|
1831
|
+
/**
|
|
1832
|
+
* Marker about to be deleted.
|
|
1833
|
+
*/
|
|
1317
1834
|
markerbeforedelete: CustomEvent<MarkerEditorEventData>;
|
|
1835
|
+
/**
|
|
1836
|
+
* Marker deleted.
|
|
1837
|
+
*/
|
|
1318
1838
|
markerdelete: CustomEvent<MarkerEditorEventData>;
|
|
1839
|
+
/**
|
|
1840
|
+
* Marker changed.
|
|
1841
|
+
*/
|
|
1319
1842
|
markerchange: CustomEvent<MarkerEditorEventData>;
|
|
1320
1843
|
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Marker area custom event data.
|
|
1846
|
+
*/
|
|
1321
1847
|
interface MarkerAreaEventData {
|
|
1322
1848
|
/**
|
|
1323
1849
|
* {@link MarkerArea} instance.
|
|
1324
1850
|
*/
|
|
1325
1851
|
markerArea: MarkerArea;
|
|
1326
1852
|
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Marker editor custom event data.
|
|
1855
|
+
*/
|
|
1327
1856
|
interface MarkerEditorEventData extends MarkerAreaEventData {
|
|
1328
1857
|
markerEditor: MarkerBaseEditor;
|
|
1329
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* @ignore
|
|
1861
|
+
*/
|
|
1862
|
+
type MarkerAreaMode = 'select' | 'create' | 'delete';
|
|
1863
|
+
/**
|
|
1864
|
+
* Marker area web component is the main annotation editor component.
|
|
1865
|
+
*
|
|
1866
|
+
* @summary
|
|
1867
|
+
* The main annotation editor component.
|
|
1868
|
+
*
|
|
1869
|
+
* @group Components
|
|
1870
|
+
*
|
|
1871
|
+
* @example
|
|
1872
|
+
*
|
|
1873
|
+
* Import `MarkerArea` from `@markerjs/markerjs3`:
|
|
1874
|
+
*
|
|
1875
|
+
* ```js
|
|
1876
|
+
* import { MarkerArea } from '@markerjs/markerjs3';
|
|
1877
|
+
* ```
|
|
1878
|
+
*
|
|
1879
|
+
* In the code below we assume that you have an `HTMLImageElement` as `targetImage`. It can be a reference to an image you already have on the page or you can simply create it with something like this:
|
|
1880
|
+
*
|
|
1881
|
+
* ```js
|
|
1882
|
+
* const targetImg = document.createElement('img');
|
|
1883
|
+
* targetImg.src = './sample.jpg';
|
|
1884
|
+
* ```
|
|
1885
|
+
*
|
|
1886
|
+
* Now you just need to create an instance of `MarkerArea`, set its `targetImage` property and add it to the page:
|
|
1887
|
+
*
|
|
1888
|
+
* ```js
|
|
1889
|
+
* const markerArea = new MarkerArea();
|
|
1890
|
+
* markerArea.targetImage = targetImg;
|
|
1891
|
+
* editorContainerDiv.appendChild(markerArea);
|
|
1892
|
+
* ```
|
|
1893
|
+
*
|
|
1894
|
+
* To initiate creation of a marker you just call `createMarker()` and pass it the name (or type) of the marker you want to create. So, if you have a button with id `addFrameButton` you can make it create a new `FrameMarker` with something like this:
|
|
1895
|
+
*
|
|
1896
|
+
* ```js
|
|
1897
|
+
* document.querySelector("#addButton")!.addEventListener("click", () => {
|
|
1898
|
+
* markerArea.createMarker("FrameMarker");
|
|
1899
|
+
* });
|
|
1900
|
+
* ```
|
|
1901
|
+
*
|
|
1902
|
+
* And whenever you want to save state (current annotation) you just call `getState()`:
|
|
1903
|
+
*
|
|
1904
|
+
* ```js
|
|
1905
|
+
* document.querySelector("#saveStateButton")!.addEventListener("click", () => {
|
|
1906
|
+
* const state = markerArea.getState();
|
|
1907
|
+
* console.log(state);
|
|
1908
|
+
* });
|
|
1909
|
+
*/
|
|
1330
1910
|
declare class MarkerArea extends HTMLElement {
|
|
1331
1911
|
private _contentContainer?;
|
|
1332
1912
|
private _canvasContainer?;
|
|
@@ -1338,22 +1918,50 @@ declare class MarkerArea extends HTMLElement {
|
|
|
1338
1918
|
private width;
|
|
1339
1919
|
private height;
|
|
1340
1920
|
private _targetWidth;
|
|
1921
|
+
/**
|
|
1922
|
+
* Returns the target image width.
|
|
1923
|
+
*/
|
|
1341
1924
|
get targetWidth(): number;
|
|
1925
|
+
/**
|
|
1926
|
+
* Sets the target image width.
|
|
1927
|
+
*/
|
|
1342
1928
|
set targetWidth(value: number);
|
|
1343
1929
|
private _targetHeight;
|
|
1930
|
+
/**
|
|
1931
|
+
* Returns the target image height.
|
|
1932
|
+
*/
|
|
1344
1933
|
get targetHeight(): number;
|
|
1934
|
+
/**
|
|
1935
|
+
* Sets the target image height.
|
|
1936
|
+
*/
|
|
1345
1937
|
set targetHeight(value: number);
|
|
1346
1938
|
private mode;
|
|
1347
1939
|
private _logoUI?;
|
|
1348
1940
|
private _isInitialized;
|
|
1349
1941
|
private _currentMarkerEditor?;
|
|
1942
|
+
/**
|
|
1943
|
+
* Returns the currently active marker editor.
|
|
1944
|
+
*/
|
|
1350
1945
|
get currentMarkerEditor(): MarkerBaseEditor | undefined;
|
|
1351
1946
|
private _selectedMarkerEditors;
|
|
1352
1947
|
private _newMarkerOutline;
|
|
1948
|
+
private _targetImageLoaded;
|
|
1353
1949
|
private _targetImage;
|
|
1950
|
+
/**
|
|
1951
|
+
* Returns the target image.
|
|
1952
|
+
*/
|
|
1354
1953
|
get targetImage(): HTMLImageElement | undefined;
|
|
1954
|
+
/**
|
|
1955
|
+
* Sets the target image.
|
|
1956
|
+
*/
|
|
1355
1957
|
set targetImage(value: HTMLImageElement | undefined);
|
|
1958
|
+
/**
|
|
1959
|
+
* The collection of available marker editor types.
|
|
1960
|
+
*/
|
|
1356
1961
|
markerEditors: Map<typeof MarkerBase, typeof MarkerBaseEditor<MarkerBase>>;
|
|
1962
|
+
/**
|
|
1963
|
+
* The collection of marker editors in the annotation.
|
|
1964
|
+
*/
|
|
1357
1965
|
editors: MarkerBaseEditor[];
|
|
1358
1966
|
private _zoomLevel;
|
|
1359
1967
|
/**
|
|
@@ -1376,15 +1984,47 @@ declare class MarkerArea extends HTMLElement {
|
|
|
1376
1984
|
private setEditingTargetSize;
|
|
1377
1985
|
private initOverlay;
|
|
1378
1986
|
private addTargetImage;
|
|
1987
|
+
/**
|
|
1988
|
+
* Registers a marker type and its editor to be available in the marker area.
|
|
1989
|
+
* @param markerType
|
|
1990
|
+
* @param editorType
|
|
1991
|
+
*/
|
|
1379
1992
|
registerMarkerType(markerType: typeof MarkerBase, editorType: typeof MarkerBaseEditor<MarkerBase>): void;
|
|
1993
|
+
/**
|
|
1994
|
+
* Creates a new marker of the specified type.
|
|
1995
|
+
* @param markerType
|
|
1996
|
+
* @returns
|
|
1997
|
+
*/
|
|
1380
1998
|
createMarker(markerType: typeof MarkerBase | string): MarkerBaseEditor<MarkerBase> | undefined;
|
|
1381
1999
|
private addNewMarker;
|
|
1382
2000
|
private markerCreated;
|
|
1383
2001
|
private markerStateChanged;
|
|
2002
|
+
/**
|
|
2003
|
+
* Deletes a marker represented by the specified editor.
|
|
2004
|
+
* @param markerEditor
|
|
2005
|
+
*/
|
|
1384
2006
|
deleteMarker(markerEditor: MarkerBaseEditor): void;
|
|
2007
|
+
/**
|
|
2008
|
+
* Deselects all markers.
|
|
2009
|
+
*/
|
|
1385
2010
|
deleteSelectedMarkers(): void;
|
|
2011
|
+
/**
|
|
2012
|
+
* Sets the current editor and selects it.
|
|
2013
|
+
*
|
|
2014
|
+
* If `editor` is not supplied the current editor is unselected.
|
|
2015
|
+
*
|
|
2016
|
+
* @param editor
|
|
2017
|
+
*/
|
|
1386
2018
|
setCurrentEditor(editor?: MarkerBaseEditor): void;
|
|
2019
|
+
/**
|
|
2020
|
+
* Selects the specified editor without setting it as the current editor.
|
|
2021
|
+
* @param editor
|
|
2022
|
+
*/
|
|
1387
2023
|
selectEditor(editor: MarkerBaseEditor): void;
|
|
2024
|
+
/**
|
|
2025
|
+
* Deselects the specified editor (or all editors if not specified).
|
|
2026
|
+
* @param editor
|
|
2027
|
+
*/
|
|
1388
2028
|
deselectEditor(editor?: MarkerBaseEditor): void;
|
|
1389
2029
|
private touchPoints;
|
|
1390
2030
|
private isDragging;
|
|
@@ -1410,8 +2050,20 @@ declare class MarkerArea extends HTMLElement {
|
|
|
1410
2050
|
private detachEvents;
|
|
1411
2051
|
private detachWindowEvents;
|
|
1412
2052
|
private getMarkerTypeByName;
|
|
2053
|
+
/**
|
|
2054
|
+
* Switches the marker area to select mode and deselects all the selected markers.
|
|
2055
|
+
*/
|
|
1413
2056
|
switchToSelectMode(): void;
|
|
2057
|
+
/**
|
|
2058
|
+
* Returns the annotation state.
|
|
2059
|
+
* @returns
|
|
2060
|
+
*/
|
|
1414
2061
|
getState(): AnnotationState;
|
|
2062
|
+
private _stateToRestore;
|
|
2063
|
+
/**
|
|
2064
|
+
* Restores the annotation from the previously saved state.
|
|
2065
|
+
* @param state
|
|
2066
|
+
*/
|
|
1415
2067
|
restoreState(state: AnnotationState): void;
|
|
1416
2068
|
private scaleMarkers;
|
|
1417
2069
|
/**
|
|
@@ -1452,10 +2104,8 @@ declare class MarkerArea extends HTMLElement {
|
|
|
1452
2104
|
}
|
|
1453
2105
|
|
|
1454
2106
|
/**
|
|
1455
|
-
*
|
|
2107
|
+
* Represents location of the manipulation grips.
|
|
1456
2108
|
*/
|
|
1457
|
-
type ColorType = 'text' | 'stroke' | 'fill' | 'background';
|
|
1458
|
-
|
|
1459
2109
|
type GripLocation = 'topleft' | 'topcenter' | 'topright' | 'leftcenter' | 'rightcenter' | 'bottomleft' | 'bottomcenter' | 'bottomright';
|
|
1460
2110
|
/**
|
|
1461
2111
|
* Represents a single resize-manipulation grip used in marker's manipulation controls.
|
|
@@ -1465,17 +2115,29 @@ declare class Grip {
|
|
|
1465
2115
|
* Grip's visual element.
|
|
1466
2116
|
*/
|
|
1467
2117
|
protected _visual?: SVGGraphicsElement;
|
|
2118
|
+
/**
|
|
2119
|
+
* Grip's visual element.
|
|
2120
|
+
*/
|
|
1468
2121
|
get visual(): SVGGraphicsElement;
|
|
1469
2122
|
/**
|
|
1470
2123
|
* Grip's size (radius).
|
|
1471
2124
|
*/
|
|
1472
2125
|
gripSize: number;
|
|
2126
|
+
/**
|
|
2127
|
+
* Grip's fill color.
|
|
2128
|
+
*/
|
|
1473
2129
|
fillColor: string;
|
|
2130
|
+
/**
|
|
2131
|
+
* Grip's stroke color.
|
|
2132
|
+
*/
|
|
1474
2133
|
strokeColor: string;
|
|
1475
2134
|
/**
|
|
1476
2135
|
* Creates a new grip.
|
|
1477
2136
|
*/
|
|
1478
2137
|
constructor();
|
|
2138
|
+
/**
|
|
2139
|
+
* Creates grip's visual.
|
|
2140
|
+
*/
|
|
1479
2141
|
protected createVisual(): void;
|
|
1480
2142
|
/**
|
|
1481
2143
|
* Returns true if passed SVG element belongs to the grip. False otherwise.
|
|
@@ -1485,13 +2147,25 @@ declare class Grip {
|
|
|
1485
2147
|
ownsTarget(el: EventTarget): boolean;
|
|
1486
2148
|
}
|
|
1487
2149
|
|
|
2150
|
+
/**
|
|
2151
|
+
* Represents a resize grip.
|
|
2152
|
+
*/
|
|
1488
2153
|
declare class ResizeGrip extends Grip {
|
|
1489
2154
|
}
|
|
1490
2155
|
|
|
2156
|
+
/**
|
|
2157
|
+
* Represents a rotation grip.
|
|
2158
|
+
*/
|
|
1491
2159
|
declare class RotateGrip extends Grip {
|
|
1492
2160
|
constructor();
|
|
1493
2161
|
}
|
|
1494
2162
|
|
|
2163
|
+
/**
|
|
2164
|
+
* Base editor for markers that can be represented by a rectangular area.
|
|
2165
|
+
*
|
|
2166
|
+
* @summary Base editor for markers that can be represented by a rectangular area.
|
|
2167
|
+
* @group Editors
|
|
2168
|
+
*/
|
|
1495
2169
|
declare class RectangularBoxMarkerBaseEditor<TMarkerType extends RectangularBoxMarkerBase = RectangularBoxMarkerBase> extends MarkerBaseEditor<TMarkerType> {
|
|
1496
2170
|
/**
|
|
1497
2171
|
* x coordinate of the top-left corner at the start of manipulation.
|
|
@@ -1529,65 +2203,65 @@ declare class RectangularBoxMarkerBaseEditor<TMarkerType extends RectangularBoxM
|
|
|
1529
2203
|
* Container for the marker's editing controls.
|
|
1530
2204
|
*/
|
|
1531
2205
|
protected controlBox: SVGGElement;
|
|
2206
|
+
/**
|
|
2207
|
+
* Container for the marker's manipulation grips.
|
|
2208
|
+
*/
|
|
1532
2209
|
protected manipulationBox: SVGGElement;
|
|
1533
2210
|
private readonly CB_DISTANCE;
|
|
1534
2211
|
private controlRect?;
|
|
1535
2212
|
private rotatorGripLine?;
|
|
1536
2213
|
private controlGrips;
|
|
2214
|
+
/**
|
|
2215
|
+
* Array of disabled resize grips.
|
|
2216
|
+
*
|
|
2217
|
+
* Use this in derived classes to disable specific resize grips.
|
|
2218
|
+
*/
|
|
1537
2219
|
protected disabledResizeGrips: GripLocation[];
|
|
1538
2220
|
private rotatorGrip?;
|
|
2221
|
+
/**
|
|
2222
|
+
* Active grip during manipulation
|
|
2223
|
+
*/
|
|
1539
2224
|
protected activeGrip?: Grip;
|
|
1540
2225
|
private disableRotation;
|
|
1541
2226
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
1542
|
-
/**
|
|
1543
|
-
* Returns true if passed SVG element belongs to the marker. False otherwise.
|
|
1544
|
-
*
|
|
1545
|
-
* @param el - target element.
|
|
1546
|
-
*/
|
|
1547
2227
|
ownsTarget(el: EventTarget): boolean;
|
|
1548
|
-
/**
|
|
1549
|
-
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
1550
|
-
*
|
|
1551
|
-
* @param point - event coordinates.
|
|
1552
|
-
* @param target - direct event target element.
|
|
1553
|
-
*/
|
|
1554
2228
|
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
1555
|
-
protected _suppressMarkerCreateEvent: boolean;
|
|
1556
2229
|
/**
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
* @param point - event coordinates.
|
|
1560
|
-
* @param target - direct event target element.
|
|
2230
|
+
* When set to true marker created event will not be triggered.
|
|
1561
2231
|
*/
|
|
2232
|
+
protected _suppressMarkerCreateEvent: boolean;
|
|
1562
2233
|
pointerUp(point: IPoint): void;
|
|
1563
|
-
/**
|
|
1564
|
-
* Handles marker manipulation (move, resize, rotate, etc.).
|
|
1565
|
-
*
|
|
1566
|
-
* @param point - event coordinates.
|
|
1567
|
-
*/
|
|
1568
2234
|
manipulate(point: IPoint): void;
|
|
1569
|
-
/**
|
|
1570
|
-
* Resizes the marker based on pointer coordinates and context.
|
|
1571
|
-
* @param point - pointer coordinates.
|
|
1572
|
-
*/
|
|
1573
2235
|
protected resize(point: IPoint): void;
|
|
1574
2236
|
/**
|
|
1575
2237
|
* Sets control box size and location.
|
|
1576
2238
|
*/
|
|
1577
2239
|
protected setSize(): void;
|
|
2240
|
+
select(multi?: boolean): void;
|
|
2241
|
+
deselect(): void;
|
|
1578
2242
|
/**
|
|
1579
|
-
*
|
|
2243
|
+
* Creates control box for manipulation controls.
|
|
1580
2244
|
*/
|
|
1581
|
-
|
|
2245
|
+
protected setupControlBox(): void;
|
|
1582
2246
|
/**
|
|
1583
|
-
*
|
|
2247
|
+
* Adjusts control box size and location.
|
|
1584
2248
|
*/
|
|
1585
|
-
deselect(): void;
|
|
1586
|
-
private setupControlBox;
|
|
1587
2249
|
protected adjustControlBox(): void;
|
|
2250
|
+
/**
|
|
2251
|
+
* Adds control grips to control box.
|
|
2252
|
+
*/
|
|
1588
2253
|
protected addControlGrips(): void;
|
|
1589
2254
|
private createRotateGrip;
|
|
2255
|
+
/**
|
|
2256
|
+
* Updates manipulation grip layout.
|
|
2257
|
+
*/
|
|
1590
2258
|
protected positionGrips(): void;
|
|
2259
|
+
/**
|
|
2260
|
+
* Positions specific grip.
|
|
2261
|
+
* @param grip
|
|
2262
|
+
* @param x
|
|
2263
|
+
* @param y
|
|
2264
|
+
*/
|
|
1591
2265
|
protected positionGrip(grip: SVGGraphicsElement | undefined, x: number, y: number): void;
|
|
1592
2266
|
/**
|
|
1593
2267
|
* Hides marker's editing controls.
|
|
@@ -1597,51 +2271,53 @@ declare class RectangularBoxMarkerBaseEditor<TMarkerType extends RectangularBoxM
|
|
|
1597
2271
|
* Shows marker's editing controls.
|
|
1598
2272
|
*/
|
|
1599
2273
|
protected showControlBox(): void;
|
|
1600
|
-
protected adjustGripVisibility(): void;
|
|
1601
2274
|
/**
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
1604
|
-
* @param scaleX - horizontal scale
|
|
1605
|
-
* @param scaleY - vertical scale
|
|
2275
|
+
* Adjusts visibility of resize grips.
|
|
1606
2276
|
*/
|
|
2277
|
+
protected adjustGripVisibility(): void;
|
|
1607
2278
|
scale(scaleX: number, scaleY: number): void;
|
|
1608
2279
|
}
|
|
1609
2280
|
|
|
2281
|
+
/**
|
|
2282
|
+
* Editor for shape outline markers.
|
|
2283
|
+
*
|
|
2284
|
+
* @summary Shape outline (unfilled shape) marker editor.
|
|
2285
|
+
* @group Editors
|
|
2286
|
+
*/
|
|
1610
2287
|
declare class ShapeOutlineMarkerEditor<TMarkerType extends ShapeOutlineMarkerBase = ShapeOutlineMarkerBase> extends RectangularBoxMarkerBaseEditor<TMarkerType> {
|
|
1611
2288
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
1612
|
-
/**
|
|
1613
|
-
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
1614
|
-
*
|
|
1615
|
-
* @param point - event coordinates.
|
|
1616
|
-
* @param target - direct event target element.
|
|
1617
|
-
*/
|
|
1618
2289
|
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
1619
|
-
/**
|
|
1620
|
-
* Resizes the marker based on the pointer coordinates.
|
|
1621
|
-
* @param point - current pointer coordinates.
|
|
1622
|
-
*/
|
|
1623
2290
|
protected resize(point: IPoint): void;
|
|
1624
|
-
/**
|
|
1625
|
-
* Handles pointer (mouse, touch, stylus, etc.) up event.
|
|
1626
|
-
*
|
|
1627
|
-
* @param point - event coordinates.
|
|
1628
|
-
* @param target - direct event target element.
|
|
1629
|
-
*/
|
|
1630
2291
|
pointerUp(point: IPoint): void;
|
|
1631
2292
|
}
|
|
1632
2293
|
|
|
2294
|
+
/**
|
|
2295
|
+
* Editor for filled shape markers.
|
|
2296
|
+
*
|
|
2297
|
+
* @summary Filled shape marker editor.
|
|
2298
|
+
* @group Editors
|
|
2299
|
+
*/
|
|
1633
2300
|
declare class ShapeMarkerEditor<TMarkerType extends ShapeMarkerBase = ShapeMarkerBase> extends ShapeOutlineMarkerEditor<TMarkerType> {
|
|
1634
2301
|
}
|
|
1635
2302
|
|
|
2303
|
+
/**
|
|
2304
|
+
* Editor for linear markers.
|
|
2305
|
+
*
|
|
2306
|
+
* @summary Editor for line-like markers.
|
|
2307
|
+
* @group Editors
|
|
2308
|
+
*/
|
|
1636
2309
|
declare class LinearMarkerEditor<TMarkerType extends LinearMarkerBase = LinearMarkerBase> extends MarkerBaseEditor<TMarkerType> {
|
|
1637
2310
|
/**
|
|
1638
2311
|
* Default line length when marker is created with a simple click (without dragging).
|
|
1639
2312
|
*/
|
|
1640
2313
|
protected defaultLength: number;
|
|
1641
2314
|
/**
|
|
1642
|
-
* Pointer
|
|
2315
|
+
* Pointer X coordinate at the start of move or resize.
|
|
1643
2316
|
*/
|
|
1644
2317
|
protected manipulationStartX: number;
|
|
2318
|
+
/**
|
|
2319
|
+
* Pointer Y coordinate at the start of move or resize.
|
|
2320
|
+
*/
|
|
1645
2321
|
protected manipulationStartY: number;
|
|
1646
2322
|
private manipulationStartX1;
|
|
1647
2323
|
private manipulationStartY1;
|
|
@@ -1651,6 +2327,9 @@ declare class LinearMarkerEditor<TMarkerType extends LinearMarkerBase = LinearMa
|
|
|
1651
2327
|
* Container for control elements.
|
|
1652
2328
|
*/
|
|
1653
2329
|
protected controlBox: SVGGElement;
|
|
2330
|
+
/**
|
|
2331
|
+
* Container for manipulation grips.
|
|
2332
|
+
*/
|
|
1654
2333
|
protected manipulationBox: SVGGElement;
|
|
1655
2334
|
/**
|
|
1656
2335
|
* First manipulation grip
|
|
@@ -1665,36 +2344,10 @@ declare class LinearMarkerEditor<TMarkerType extends LinearMarkerBase = LinearMa
|
|
|
1665
2344
|
*/
|
|
1666
2345
|
protected activeGrip?: ResizeGrip;
|
|
1667
2346
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
1668
|
-
/**
|
|
1669
|
-
* Returns true if passed SVG element belongs to the marker. False otherwise.
|
|
1670
|
-
*
|
|
1671
|
-
* @param el - target element.
|
|
1672
|
-
*/
|
|
1673
2347
|
ownsTarget(el: EventTarget): boolean;
|
|
1674
|
-
/**
|
|
1675
|
-
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
1676
|
-
*
|
|
1677
|
-
* @param point - event coordinates.
|
|
1678
|
-
* @param target - direct event target element.
|
|
1679
|
-
*/
|
|
1680
2348
|
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
1681
|
-
/**
|
|
1682
|
-
* Handles pointer (mouse, touch, stylus, etc.) up event.
|
|
1683
|
-
*
|
|
1684
|
-
* @param point - event coordinates.
|
|
1685
|
-
* @param target - direct event target element.
|
|
1686
|
-
*/
|
|
1687
2349
|
pointerUp(point: IPoint): void;
|
|
1688
|
-
/**
|
|
1689
|
-
* Handles marker manipulation (move, resize, rotate, etc.).
|
|
1690
|
-
*
|
|
1691
|
-
* @param point - event coordinates.
|
|
1692
|
-
*/
|
|
1693
2350
|
manipulate(point: IPoint): void;
|
|
1694
|
-
/**
|
|
1695
|
-
* Resizes the line marker.
|
|
1696
|
-
* @param point - current manipulation coordinates.
|
|
1697
|
-
*/
|
|
1698
2351
|
protected resize(point: IPoint): void;
|
|
1699
2352
|
/**
|
|
1700
2353
|
* Creates control box for manipulation controls.
|
|
@@ -1721,70 +2374,53 @@ declare class LinearMarkerEditor<TMarkerType extends LinearMarkerBase = LinearMa
|
|
|
1721
2374
|
* @param y - new Y coordinate
|
|
1722
2375
|
*/
|
|
1723
2376
|
protected positionGrip(grip: SVGGraphicsElement, x: number, y: number): void;
|
|
1724
|
-
/**
|
|
1725
|
-
* Displays marker's controls.
|
|
1726
|
-
*/
|
|
1727
2377
|
select(multi?: boolean): void;
|
|
1728
|
-
/**
|
|
1729
|
-
* Hides marker's controls.
|
|
1730
|
-
*/
|
|
1731
2378
|
deselect(): void;
|
|
1732
2379
|
}
|
|
1733
2380
|
|
|
2381
|
+
/**
|
|
2382
|
+
* Editor for polygon markers.
|
|
2383
|
+
*
|
|
2384
|
+
* @summary Polygon marker editor.
|
|
2385
|
+
* @group Editors
|
|
2386
|
+
*/
|
|
1734
2387
|
declare class PolygonMarkerEditor<TMarkerType extends PolygonMarker = PolygonMarker> extends MarkerBaseEditor<TMarkerType> {
|
|
1735
2388
|
/**
|
|
1736
2389
|
* Default line length when marker is created with a simple click (without dragging).
|
|
1737
2390
|
*/
|
|
1738
2391
|
protected defaultLength: number;
|
|
1739
2392
|
/**
|
|
1740
|
-
* Pointer
|
|
2393
|
+
* Pointer X coordinate at the start of move or resize.
|
|
1741
2394
|
*/
|
|
1742
2395
|
protected manipulationStartX: number;
|
|
2396
|
+
/**
|
|
2397
|
+
* Pointer Y coordinate at the start of move or resize.
|
|
2398
|
+
*/
|
|
1743
2399
|
protected manipulationStartY: number;
|
|
1744
2400
|
/**
|
|
1745
2401
|
* Container for control elements.
|
|
1746
2402
|
*/
|
|
1747
2403
|
protected controlBox: SVGGElement;
|
|
2404
|
+
/**
|
|
2405
|
+
* Container for manipulation grips.
|
|
2406
|
+
*/
|
|
1748
2407
|
protected manipulationBox: SVGGElement;
|
|
2408
|
+
/**
|
|
2409
|
+
* Array of manipulation grips.
|
|
2410
|
+
*/
|
|
1749
2411
|
protected grips: ResizeGrip[];
|
|
1750
2412
|
/**
|
|
1751
2413
|
* Active manipulation grip.
|
|
1752
2414
|
*/
|
|
1753
2415
|
protected activeGrip?: ResizeGrip;
|
|
1754
2416
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
1755
|
-
/**
|
|
1756
|
-
* Returns true if passed SVG element belongs to the marker. False otherwise.
|
|
1757
|
-
*
|
|
1758
|
-
* @param el - target element.
|
|
1759
|
-
*/
|
|
1760
2417
|
ownsTarget(el: EventTarget): boolean;
|
|
1761
|
-
/**
|
|
1762
|
-
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
1763
|
-
*
|
|
1764
|
-
* @param point - event coordinates.
|
|
1765
|
-
* @param target - direct event target element.
|
|
1766
|
-
*/
|
|
1767
2418
|
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
1768
2419
|
private startCreation;
|
|
1769
2420
|
private addNewPointWhileCreating;
|
|
1770
2421
|
private finishCreation;
|
|
1771
|
-
/**
|
|
1772
|
-
* Handles pointer (mouse, touch, stylus, etc.) up event.
|
|
1773
|
-
*
|
|
1774
|
-
* @param point - event coordinates.
|
|
1775
|
-
* @param target - direct event target element.
|
|
1776
|
-
*/
|
|
1777
2422
|
pointerUp(point: IPoint): void;
|
|
1778
|
-
/**
|
|
1779
|
-
* Handles marker manipulation (move, resize, rotate, etc.).
|
|
1780
|
-
*
|
|
1781
|
-
* @param point - event coordinates.
|
|
1782
|
-
*/
|
|
1783
2423
|
manipulate(point: IPoint): void;
|
|
1784
|
-
/**
|
|
1785
|
-
* Resizes the line marker.
|
|
1786
|
-
* @param point - current manipulation coordinates.
|
|
1787
|
-
*/
|
|
1788
2424
|
protected resize(point: IPoint): void;
|
|
1789
2425
|
dblClick(point: IPoint, target?: EventTarget | undefined): void;
|
|
1790
2426
|
/**
|
|
@@ -1812,21 +2448,24 @@ declare class PolygonMarkerEditor<TMarkerType extends PolygonMarker = PolygonMar
|
|
|
1812
2448
|
* @param y - new Y coordinate
|
|
1813
2449
|
*/
|
|
1814
2450
|
protected positionGrip(grip: SVGGraphicsElement, x: number, y: number): void;
|
|
1815
|
-
/**
|
|
1816
|
-
* Displays marker's controls.
|
|
1817
|
-
*/
|
|
1818
2451
|
select(multi?: boolean): void;
|
|
1819
|
-
/**
|
|
1820
|
-
* Hides marker's controls.
|
|
1821
|
-
*/
|
|
1822
2452
|
deselect(): void;
|
|
1823
2453
|
}
|
|
1824
2454
|
|
|
2455
|
+
/**
|
|
2456
|
+
* Editor for freehand markers.
|
|
2457
|
+
*
|
|
2458
|
+
* @summary Freehand marker editor.
|
|
2459
|
+
* @group Editors
|
|
2460
|
+
*/
|
|
1825
2461
|
declare class FreehandMarkerEditor<TMarkerType extends FreehandMarker = FreehandMarker> extends MarkerBaseEditor<TMarkerType> {
|
|
1826
2462
|
/**
|
|
1827
|
-
* Pointer
|
|
2463
|
+
* Pointer X coordinate at the start of move or resize.
|
|
1828
2464
|
*/
|
|
1829
2465
|
protected manipulationStartX: number;
|
|
2466
|
+
/**
|
|
2467
|
+
* Pointer Y coordinate at the start of move or resize.
|
|
2468
|
+
*/
|
|
1830
2469
|
protected manipulationStartY: number;
|
|
1831
2470
|
/**
|
|
1832
2471
|
* Container for control elements.
|
|
@@ -1834,47 +2473,19 @@ declare class FreehandMarkerEditor<TMarkerType extends FreehandMarker = Freehand
|
|
|
1834
2473
|
protected controlBox: SVGGElement;
|
|
1835
2474
|
private controlRect?;
|
|
1836
2475
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
1837
|
-
/**
|
|
1838
|
-
* Returns true if passed SVG element belongs to the marker. False otherwise.
|
|
1839
|
-
*
|
|
1840
|
-
* @param el - target element.
|
|
1841
|
-
*/
|
|
1842
2476
|
ownsTarget(el: EventTarget): boolean;
|
|
1843
|
-
/**
|
|
1844
|
-
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
1845
|
-
*
|
|
1846
|
-
* @param point - event coordinates.
|
|
1847
|
-
* @param target - direct event target element.
|
|
1848
|
-
*/
|
|
1849
2477
|
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
1850
2478
|
private startCreation;
|
|
1851
2479
|
private addNewPointWhileCreating;
|
|
1852
2480
|
private finishCreation;
|
|
1853
|
-
/**
|
|
1854
|
-
* Handles pointer (mouse, touch, stylus, etc.) up event.
|
|
1855
|
-
*
|
|
1856
|
-
* @param point - event coordinates.
|
|
1857
|
-
* @param target - direct event target element.
|
|
1858
|
-
*/
|
|
1859
2481
|
pointerUp(point: IPoint): void;
|
|
1860
|
-
/**
|
|
1861
|
-
* Handles marker manipulation (move, resize, rotate, etc.).
|
|
1862
|
-
*
|
|
1863
|
-
* @param point - event coordinates.
|
|
1864
|
-
*/
|
|
1865
2482
|
manipulate(point: IPoint): void;
|
|
1866
2483
|
/**
|
|
1867
2484
|
* Creates control box for manipulation controls.
|
|
1868
2485
|
*/
|
|
1869
2486
|
protected setupControlBox(): void;
|
|
1870
2487
|
protected adjustControlBox(): void;
|
|
1871
|
-
/**
|
|
1872
|
-
* Displays marker's controls.
|
|
1873
|
-
*/
|
|
1874
2488
|
select(): void;
|
|
1875
|
-
/**
|
|
1876
|
-
* Hides marker's controls.
|
|
1877
|
-
*/
|
|
1878
2489
|
deselect(): void;
|
|
1879
2490
|
}
|
|
1880
2491
|
|
|
@@ -1882,6 +2493,9 @@ declare class FreehandMarkerEditor<TMarkerType extends FreehandMarker = Freehand
|
|
|
1882
2493
|
* Text changed event handler type.
|
|
1883
2494
|
*/
|
|
1884
2495
|
type TextChangedHandler = (text: string) => void;
|
|
2496
|
+
/**
|
|
2497
|
+
* Blur event handler type.
|
|
2498
|
+
*/
|
|
1885
2499
|
type BlurHandler = () => void;
|
|
1886
2500
|
/**
|
|
1887
2501
|
* Represents a text block editor element.
|
|
@@ -1962,12 +2576,21 @@ declare class TextBlockEditor {
|
|
|
1962
2576
|
*/
|
|
1963
2577
|
set textColor(value: string);
|
|
1964
2578
|
private _bgColor;
|
|
2579
|
+
/**
|
|
2580
|
+
* Returns text block's background color.
|
|
2581
|
+
*/
|
|
1965
2582
|
get bgColor(): string;
|
|
2583
|
+
/**
|
|
2584
|
+
* Sets text block's background color.
|
|
2585
|
+
*/
|
|
1966
2586
|
set bgColor(value: string);
|
|
1967
2587
|
/**
|
|
1968
2588
|
* Text changed event handler.
|
|
1969
2589
|
*/
|
|
1970
2590
|
onTextChanged?: TextChangedHandler;
|
|
2591
|
+
/**
|
|
2592
|
+
* Blur event handler.
|
|
2593
|
+
*/
|
|
1971
2594
|
onBlur?: BlurHandler;
|
|
1972
2595
|
/**
|
|
1973
2596
|
* Creates a new text block editor instance.
|
|
@@ -1990,49 +2613,81 @@ declare class TextBlockEditor {
|
|
|
1990
2613
|
blur(): void;
|
|
1991
2614
|
}
|
|
1992
2615
|
|
|
2616
|
+
/**
|
|
2617
|
+
* Editor for text markers.
|
|
2618
|
+
*
|
|
2619
|
+
* @summary Text marker editor.
|
|
2620
|
+
* @group Editors
|
|
2621
|
+
*/
|
|
1993
2622
|
declare class TextMarkerEditor<TMarkerType extends TextMarker = TextMarker> extends RectangularBoxMarkerBaseEditor<TMarkerType> {
|
|
2623
|
+
/**
|
|
2624
|
+
* Container for text block editor.
|
|
2625
|
+
*/
|
|
1994
2626
|
protected textBlockEditorContainer: SVGForeignObjectElement;
|
|
2627
|
+
/**
|
|
2628
|
+
* Text block editor.
|
|
2629
|
+
*/
|
|
1995
2630
|
protected textBlockEditor: TextBlockEditor;
|
|
2631
|
+
/**
|
|
2632
|
+
* Text color.
|
|
2633
|
+
*/
|
|
1996
2634
|
set color(color: string);
|
|
2635
|
+
/**
|
|
2636
|
+
* Text color.
|
|
2637
|
+
*/
|
|
1997
2638
|
get color(): string;
|
|
2639
|
+
/**
|
|
2640
|
+
* Sets text's font family.
|
|
2641
|
+
*/
|
|
1998
2642
|
set fontFamily(font: string);
|
|
2643
|
+
/**
|
|
2644
|
+
* Returns text's font family.
|
|
2645
|
+
*/
|
|
1999
2646
|
get fontFamily(): string;
|
|
2647
|
+
/**
|
|
2648
|
+
* Sets text's font size.
|
|
2649
|
+
*/
|
|
2000
2650
|
set fontSize(size: FontSize);
|
|
2651
|
+
/**
|
|
2652
|
+
* Returns text's font size.
|
|
2653
|
+
*/
|
|
2001
2654
|
get fontSize(): FontSize;
|
|
2002
2655
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
2003
2656
|
private _pointerDownTime;
|
|
2004
2657
|
private _pointerDownPoint;
|
|
2005
|
-
/**
|
|
2006
|
-
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
2007
|
-
*
|
|
2008
|
-
* @param point - event coordinates.
|
|
2009
|
-
* @param target - direct event target element.
|
|
2010
|
-
*/
|
|
2011
2658
|
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
2012
2659
|
dblClick(point: IPoint, target?: EventTarget): void;
|
|
2013
2660
|
protected setSize(): void;
|
|
2014
|
-
/**
|
|
2015
|
-
* Resizes the marker based on the pointer coordinates.
|
|
2016
|
-
* @param point - current pointer coordinates.
|
|
2017
|
-
*/
|
|
2018
2661
|
protected resize(point: IPoint): void;
|
|
2019
|
-
/**
|
|
2020
|
-
* Handles pointer (mouse, touch, stylus, etc.) up event.
|
|
2021
|
-
*
|
|
2022
|
-
* @param point - event coordinates.
|
|
2023
|
-
* @param target - direct event target element.
|
|
2024
|
-
*/
|
|
2025
2662
|
pointerUp(point: IPoint): void;
|
|
2026
2663
|
private showEditor;
|
|
2027
2664
|
private hideEditor;
|
|
2028
2665
|
private markerSizeChanged;
|
|
2029
2666
|
}
|
|
2030
2667
|
|
|
2668
|
+
/**
|
|
2669
|
+
* Editor for arrow markers.
|
|
2670
|
+
*
|
|
2671
|
+
* @summary Arrow marker editor.
|
|
2672
|
+
* @group Editors
|
|
2673
|
+
*/
|
|
2031
2674
|
declare class ArrowMarkerEditor<TMarkerType extends ArrowMarker = ArrowMarker> extends LinearMarkerEditor<TMarkerType> {
|
|
2675
|
+
/**
|
|
2676
|
+
* Sets the arrow type.
|
|
2677
|
+
*/
|
|
2032
2678
|
set arrowType(value: ArrowType);
|
|
2679
|
+
/**
|
|
2680
|
+
* Returns the arrow type.
|
|
2681
|
+
*/
|
|
2033
2682
|
get arrowType(): ArrowType;
|
|
2034
2683
|
}
|
|
2035
2684
|
|
|
2685
|
+
/**
|
|
2686
|
+
* Editor for callout markers.
|
|
2687
|
+
*
|
|
2688
|
+
* @summary Callout marker editor.
|
|
2689
|
+
* @group Editors
|
|
2690
|
+
*/
|
|
2036
2691
|
declare class CalloutMarkerEditor<TMarkerType extends CalloutMarker = CalloutMarker> extends TextMarkerEditor<TMarkerType> {
|
|
2037
2692
|
private tipGrip?;
|
|
2038
2693
|
private manipulationStartTipPositionX;
|
|
@@ -2046,43 +2701,75 @@ declare class CalloutMarkerEditor<TMarkerType extends CalloutMarker = CalloutMar
|
|
|
2046
2701
|
protected resize(point: IPoint): void;
|
|
2047
2702
|
}
|
|
2048
2703
|
|
|
2704
|
+
/**
|
|
2705
|
+
* Editor for image markers.
|
|
2706
|
+
*
|
|
2707
|
+
* @summary Image marker editor.
|
|
2708
|
+
* @group Editors
|
|
2709
|
+
*/
|
|
2049
2710
|
declare class ImageMarkerEditor<TMarkerType extends ImageMarkerBase = ImageMarkerBase> extends RectangularBoxMarkerBaseEditor<TMarkerType> {
|
|
2050
2711
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
2051
|
-
/**
|
|
2052
|
-
* Handles pointer (mouse, touch, stylus, etc.) down event.
|
|
2053
|
-
*
|
|
2054
|
-
* @param point - event coordinates.
|
|
2055
|
-
* @param target - direct event target element.
|
|
2056
|
-
*/
|
|
2057
2712
|
pointerDown(point: IPoint, target?: EventTarget): void;
|
|
2058
|
-
/**
|
|
2059
|
-
* Handles pointer (mouse, touch, stylus, etc.) up event.
|
|
2060
|
-
*
|
|
2061
|
-
* @param point - event coordinates.
|
|
2062
|
-
* @param target - direct event target element.
|
|
2063
|
-
*/
|
|
2064
2713
|
pointerUp(point: IPoint): void;
|
|
2065
2714
|
}
|
|
2066
2715
|
|
|
2716
|
+
/**
|
|
2717
|
+
* Editor for caption frame markers.
|
|
2718
|
+
*
|
|
2719
|
+
* @summary Caption frame marker editor.
|
|
2720
|
+
* @group Editors
|
|
2721
|
+
*/
|
|
2067
2722
|
declare class CaptionFrameMarkerEditor<TMarkerType extends CaptionFrameMarker = CaptionFrameMarker> extends TextMarkerEditor<TMarkerType> {
|
|
2068
2723
|
constructor(properties: MarkerEditorProperties<TMarkerType>);
|
|
2069
2724
|
protected setSize(): void;
|
|
2070
2725
|
}
|
|
2071
2726
|
|
|
2727
|
+
/**
|
|
2728
|
+
* Event map for {@link MarkerView}.
|
|
2729
|
+
*/
|
|
2072
2730
|
interface MarkerViewEventMap {
|
|
2073
2731
|
/**
|
|
2074
2732
|
* Viewer initialized.
|
|
2075
2733
|
*/
|
|
2076
2734
|
viewinit: CustomEvent<MarkerViewEventData>;
|
|
2735
|
+
/**
|
|
2736
|
+
* Viewer shown.
|
|
2737
|
+
*/
|
|
2077
2738
|
viewshow: CustomEvent<MarkerViewEventData>;
|
|
2739
|
+
/**
|
|
2740
|
+
* Viewer state restored.
|
|
2741
|
+
*/
|
|
2078
2742
|
viewrestorestate: CustomEvent<MarkerViewEventData>;
|
|
2079
2743
|
}
|
|
2744
|
+
/**
|
|
2745
|
+
* Event data for {@link MarkerView}.
|
|
2746
|
+
*/
|
|
2080
2747
|
interface MarkerViewEventData {
|
|
2081
2748
|
/**
|
|
2082
2749
|
* {@link MarkerView} instance.
|
|
2083
2750
|
*/
|
|
2084
2751
|
markerView: MarkerView;
|
|
2085
2752
|
}
|
|
2753
|
+
/**
|
|
2754
|
+
* MarkerView is the main annotation viewer web component.
|
|
2755
|
+
*
|
|
2756
|
+
* @summary
|
|
2757
|
+
* The main annotation viewer web component.
|
|
2758
|
+
*
|
|
2759
|
+
* @group Components
|
|
2760
|
+
*
|
|
2761
|
+
* @example
|
|
2762
|
+
* To show dynamic annotation overlays on top of the original image you use `MarkerView`.
|
|
2763
|
+
* ```js
|
|
2764
|
+
* import { MarkerView } from '@markerjs/markerjs3';
|
|
2765
|
+
*
|
|
2766
|
+
* const markerView = new MarkerView();
|
|
2767
|
+
* markerView.targetImage = targetImg;
|
|
2768
|
+
* viewerContainer.appendChild(markerView);
|
|
2769
|
+
*
|
|
2770
|
+
* markerView.show(savedState);
|
|
2771
|
+
* ```
|
|
2772
|
+
*/
|
|
2086
2773
|
declare class MarkerView extends HTMLElement {
|
|
2087
2774
|
private _contentContainer?;
|
|
2088
2775
|
private _canvasContainer?;
|
|
@@ -2092,15 +2779,40 @@ declare class MarkerView extends HTMLElement {
|
|
|
2092
2779
|
private width;
|
|
2093
2780
|
private height;
|
|
2094
2781
|
private _targetWidth;
|
|
2782
|
+
/**
|
|
2783
|
+
* Returns the target image width.
|
|
2784
|
+
*/
|
|
2095
2785
|
get targetWidth(): number;
|
|
2786
|
+
/**
|
|
2787
|
+
* Sets the target image width.
|
|
2788
|
+
*/
|
|
2096
2789
|
set targetWidth(value: number);
|
|
2097
2790
|
private _targetHeight;
|
|
2791
|
+
/**
|
|
2792
|
+
* Returns the target image height.
|
|
2793
|
+
*/
|
|
2098
2794
|
get targetHeight(): number;
|
|
2795
|
+
/**
|
|
2796
|
+
* Sets the target image height.
|
|
2797
|
+
*/
|
|
2099
2798
|
set targetHeight(value: number);
|
|
2799
|
+
private _targetImageLoaded;
|
|
2100
2800
|
private _targetImage;
|
|
2801
|
+
/**
|
|
2802
|
+
* Returns the target image.
|
|
2803
|
+
*/
|
|
2101
2804
|
get targetImage(): HTMLImageElement | undefined;
|
|
2805
|
+
/**
|
|
2806
|
+
* Sets the target image.
|
|
2807
|
+
*/
|
|
2102
2808
|
set targetImage(value: HTMLImageElement | undefined);
|
|
2809
|
+
/**
|
|
2810
|
+
* Marker types available for the viewer.
|
|
2811
|
+
*/
|
|
2103
2812
|
markerTypes: Array<typeof MarkerBase>;
|
|
2813
|
+
/**
|
|
2814
|
+
* Collection of markers currently displayed on the viewer.
|
|
2815
|
+
*/
|
|
2104
2816
|
markers: MarkerBase[];
|
|
2105
2817
|
private _logoUI?;
|
|
2106
2818
|
private _zoomLevel;
|
|
@@ -2127,7 +2839,16 @@ declare class MarkerView extends HTMLElement {
|
|
|
2127
2839
|
private detachEvents;
|
|
2128
2840
|
private detachWindowEvents;
|
|
2129
2841
|
private getMarkerTypeByName;
|
|
2842
|
+
/**
|
|
2843
|
+
* Adds a new marker type to be available in the viewer.
|
|
2844
|
+
* @param markerType
|
|
2845
|
+
*/
|
|
2130
2846
|
registerMarkerType(markerType: typeof MarkerBase): void;
|
|
2847
|
+
private _stateToRestore;
|
|
2848
|
+
/**
|
|
2849
|
+
* Loads and shows previously saved annotation state.
|
|
2850
|
+
* @param state
|
|
2851
|
+
*/
|
|
2131
2852
|
show(state: AnnotationState): void;
|
|
2132
2853
|
private scaleMarkers;
|
|
2133
2854
|
/**
|
|
@@ -2148,21 +2869,73 @@ declare class MarkerView extends HTMLElement {
|
|
|
2148
2869
|
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => void, options?: boolean | EventListenerOptions | undefined): void;
|
|
2149
2870
|
}
|
|
2150
2871
|
|
|
2872
|
+
/**
|
|
2873
|
+
* @module Renderer
|
|
2874
|
+
* @category API Reference
|
|
2875
|
+
*/
|
|
2876
|
+
|
|
2877
|
+
/**
|
|
2878
|
+
* Renderer is used to rasterize annotations.
|
|
2879
|
+
*
|
|
2880
|
+
* @example
|
|
2881
|
+
* To render the annotation as a static image you use `Renderer`.
|
|
2882
|
+
*
|
|
2883
|
+
* ```js
|
|
2884
|
+
* import { MarkerArea, Renderer } from '@markerjs/markerjs3';
|
|
2885
|
+
* ```
|
|
2886
|
+
*
|
|
2887
|
+
* Just create an instance of it and pass the annotation state to the `rasterize()` method:
|
|
2888
|
+
*
|
|
2889
|
+
* ```js
|
|
2890
|
+
* const renderer = new Renderer();
|
|
2891
|
+
* renderer.targetImage = targetImg;
|
|
2892
|
+
* const dataUrl = await renderer.rasterize(markerArea.getState());
|
|
2893
|
+
*
|
|
2894
|
+
* const img = document.createElement('img');
|
|
2895
|
+
* img.src = dataUrl;
|
|
2896
|
+
*
|
|
2897
|
+
* someDiv.appendChild(img);
|
|
2898
|
+
* ```
|
|
2899
|
+
*/
|
|
2151
2900
|
declare class Renderer {
|
|
2152
2901
|
private _mainCanvas?;
|
|
2153
2902
|
private _editingTarget?;
|
|
2154
2903
|
private _renderHelperContainer?;
|
|
2155
2904
|
private _targetWidth;
|
|
2905
|
+
/**
|
|
2906
|
+
* Width of the target image.
|
|
2907
|
+
*/
|
|
2156
2908
|
get targetWidth(): number;
|
|
2909
|
+
/**
|
|
2910
|
+
* Width of the target image.
|
|
2911
|
+
*/
|
|
2157
2912
|
set targetWidth(value: number);
|
|
2158
2913
|
private _targetHeight;
|
|
2914
|
+
/**
|
|
2915
|
+
* Height of the target image.
|
|
2916
|
+
*/
|
|
2159
2917
|
get targetHeight(): number;
|
|
2918
|
+
/**
|
|
2919
|
+
* Height of the target image.
|
|
2920
|
+
*/
|
|
2160
2921
|
set targetHeight(value: number);
|
|
2161
2922
|
private _targetImageLoaded;
|
|
2162
2923
|
private _targetImage;
|
|
2924
|
+
/**
|
|
2925
|
+
* Target image to render annotations on.
|
|
2926
|
+
*/
|
|
2163
2927
|
get targetImage(): HTMLImageElement | undefined;
|
|
2928
|
+
/**
|
|
2929
|
+
* Target image to render annotations on.
|
|
2930
|
+
*/
|
|
2164
2931
|
set targetImage(value: HTMLImageElement | undefined);
|
|
2932
|
+
/**
|
|
2933
|
+
* Marker types available for rendering.
|
|
2934
|
+
*/
|
|
2165
2935
|
markerTypes: Array<typeof MarkerBase>;
|
|
2936
|
+
/**
|
|
2937
|
+
* Array of markers to render.
|
|
2938
|
+
*/
|
|
2166
2939
|
markers: MarkerBase[];
|
|
2167
2940
|
private _isInitialized;
|
|
2168
2941
|
/**
|
|
@@ -2205,10 +2978,24 @@ declare class Renderer {
|
|
|
2205
2978
|
private addTargetImage;
|
|
2206
2979
|
private addNewMarker;
|
|
2207
2980
|
private getMarkerTypeByName;
|
|
2981
|
+
/**
|
|
2982
|
+
* Adds a new marker type to the list of available marker types.
|
|
2983
|
+
* @param markerType - Marker type to register.
|
|
2984
|
+
*/
|
|
2208
2985
|
registerMarkerType(markerType: typeof MarkerBase): void;
|
|
2986
|
+
/**
|
|
2987
|
+
* Restores the annotation state.
|
|
2988
|
+
* @param state - Annotation state to restore.
|
|
2989
|
+
*/
|
|
2209
2990
|
restoreState(state: AnnotationState): void;
|
|
2210
2991
|
private scaleMarkers;
|
|
2992
|
+
/**
|
|
2993
|
+
* Rasterizes the annotation.
|
|
2994
|
+
* @param state - annotation state to render.
|
|
2995
|
+
* @param targetCanvas - optional target canvas to render the annotation on.
|
|
2996
|
+
* @returns
|
|
2997
|
+
*/
|
|
2211
2998
|
rasterize(state: AnnotationState, targetCanvas?: HTMLCanvasElement): Promise<string>;
|
|
2212
2999
|
}
|
|
2213
3000
|
|
|
2214
|
-
export { type AnnotationState, ArrowMarker, ArrowMarkerEditor, type ArrowMarkerState, type ArrowType, CalloutMarker, CalloutMarkerEditor, type CalloutMarkerState, CaptionFrameMarker, CaptionFrameMarkerEditor, type CaptionFrameMarkerState, CheckImageMarker,
|
|
3001
|
+
export { Activator, type AnnotationState, ArrowMarker, ArrowMarkerEditor, type ArrowMarkerState, type ArrowType, type BlurHandler, CalloutMarker, CalloutMarkerEditor, type CalloutMarkerState, CaptionFrameMarker, CaptionFrameMarkerEditor, type CaptionFrameMarkerState, CheckImageMarker, CoverMarker, CustomImageMarker, EllipseFrameMarker, EllipseMarker, type FontSize, FrameMarker, FreehandMarker, FreehandMarkerEditor, type FreehandMarkerState, Grip, type GripLocation, HighlightMarker, type IPoint, type ISize, type ITransformMatrix, ImageMarkerBase, type ImageMarkerBaseState, ImageMarkerEditor, type ImageType, LineMarker, LinearMarkerBase, type LinearMarkerBaseState, LinearMarkerEditor, MarkerArea, type MarkerAreaEventData, type MarkerAreaEventMap, type MarkerAreaMode, MarkerBase, MarkerBaseEditor, type MarkerBaseState, type MarkerCreationStyle, type MarkerEditorEventData, type MarkerEditorProperties, type MarkerEditorState, type MarkerStage, MarkerView, type MarkerViewEventData, type MarkerViewEventMap, MeasurementMarker, PolygonMarker, PolygonMarkerEditor, type PolygonMarkerState, RectangularBoxMarkerBase, type RectangularBoxMarkerBaseState, Renderer, ResizeGrip, RotateGrip, ShapeMarkerBase, type ShapeMarkerBaseState, ShapeMarkerEditor, ShapeOutlineMarkerBase, type ShapeOutlineMarkerBaseState, ShapeOutlineMarkerEditor, SvgHelper, TextBlock, TextBlockEditor, type TextChangedHandler, TextMarker, TextMarkerEditor, type TextMarkerState, XImageMarker };
|