@linkurious/ogma-annotations 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- :root{--handle-width: 2px;--point-handle-width: calc(3 * var(--handle-width))}svg text{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.handle{position:absolute;background-color:#38e}.handle.line{cursor:move}.annotation-text-handle textarea{outline:none;margin:0;border:0;width:100%;height:100%;cursor:text;padding:0;z-index:1000;resize:none;white-space:break-spaces;background:transparent;overflow:hidden}.annotation-text-handle .noevents{pointer-events:none;z-index:20}.line-handle,.point-handle{z-index:30}.line-handle.top{cursor:ns-resize;height:var(--handle-width);left:0;width:100%;top:calc(var(--handle-width) * -1)}.line-handle.bottom{cursor:ns-resize;height:var(--handle-width);width:100%;left:0;bottom:calc(var(--handle-width) * -1)}.line-handle.left{cursor:ew-resize;height:100%;top:0;left:calc(var(--handle-width) * -1);width:var(--handle-width)}.line-handle.right{cursor:ew-resize;height:100%;right:calc(var(--handle-width) * -1);top:0;width:var(--handle-width)}.line-handle.top,.line-handle.bottom,.line-handle.left,.line-handle.right{cursor:move}.point-handle{width:var(--point-handle-width);height:var(--point-handle-width)}.point-handle.top-left,.point-handle.bottom-right{cursor:nwse-resize}.point-handle.top-right,.point-handle.bottom-left{cursor:nesw-resize}.point-handle.bottom-left,.point-handle.bottom-right{top:calc(100% - (var(--point-handle-width) - var(--handle-width)) * .5)}.point-handle.top-left,.point-handle.top-right{top:calc((var(--point-handle-width) + var(--handle-width)) * -.5)}.point-handle.bottom-left,.point-handle.top-left{left:calc((var(--point-handle-width) + var(--handle-width)) * -.5)}.point-handle.bottom-right,.point-handle.top-right{left:calc(100% - (var(--point-handle-width) + var(--handle-width)) * .25)}.arrow-handle>.handle{height:var(--point-handle-width);width:var(--point-handle-width);border-radius:50%;cursor:move;transform:translate(-50%,-50%)}.arrow-handle>.line{height:var(--handle-width);border-radius:0;cursor:move}.annotations-hidden-input{position:absolute;bottom:0;left:0;visibility:hidden;display:block}.active{background-color:#38e}
1
+ :root{--handle-width: 2px;--point-handle-width: calc(3 * var(--handle-width));--point-handle-border: 2px;--point-handle-total: calc( var(--point-handle-width) + var(--point-handle-border) );--handle-color: #38e}svg text{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.handle{position:absolute;background-color:var(--handle-color)}.handle.line{cursor:move}.annotation-text-handle textarea{outline:none;margin:0;border:0;width:100%;height:100%;cursor:text;padding:0;z-index:1000;resize:none;white-space:break-spaces;background:transparent;overflow:hidden}.annotation-text-handle .noevents{pointer-events:none;z-index:20}.line-handle,.point-handle{z-index:30}.line-handle.top{cursor:ns-resize;height:var(--handle-width);left:0;width:100%;top:calc(var(--handle-width) * -1)}.line-handle.bottom{cursor:ns-resize;height:var(--handle-width);width:100%;left:0;bottom:calc(var(--handle-width) * -1)}.line-handle.left{cursor:ew-resize;height:100%;top:0;left:calc(var(--handle-width) * -1);width:var(--handle-width)}.line-handle.right{cursor:ew-resize;height:100%;right:calc(var(--handle-width) * -1);top:0;width:var(--handle-width)}.line-handle.top,.line-handle.bottom,.line-handle.left,.line-handle.right{cursor:move}.point-handle{border-radius:50%;background-color:#fff;transform-origin:center;transform:translate(-50%,-50%);border:var(--point-handle-border) solid var(--handle-color);width:var(--point-handle-width);height:var(--point-handle-width)}.point-handle.top-left{transform:translate(-75%,-75%)}.point-handle.top-right{transform:translate(-25%,-75%)}.point-handle.bottom-left{transform:translate(-75%,-25%)}.point-handle.bottom-right{transform:translate(-25%,-25%)}.point-handle.top-left,.point-handle.bottom-right{cursor:nwse-resize}.point-handle.top-right,.point-handle.bottom-left{cursor:nesw-resize}.point-handle.bottom-left,.point-handle.bottom-right{top:100%}.point-handle.top-left,.point-handle.top-right{top:0}.point-handle.bottom-left,.point-handle.top-left{left:0}.point-handle.bottom-right,.point-handle.top-right{left:100%}.arrow-handle>.handle{height:var(--point-handle-width);width:var(--point-handle-width);border-radius:50%;cursor:move;transform:translate(-50%,-50%)}.arrow-handle>.line{height:var(--handle-width);border-radius:0;cursor:move}.annotations-hidden-input{position:absolute;bottom:0;left:0;visibility:hidden;display:block}.active{background-color:#38e}.annotation-text{pointer-events:visible;cursor:pointer}.annotation-text:hover>rect{stroke:var(--handle-color)}
@@ -31,6 +31,7 @@ export declare class Control extends EventEmitter<FeatureEvents> {
31
31
  private _onRemoved;
32
32
  private _onUnselect;
33
33
  private _onSelect;
34
+ private refreshTextLinks;
34
35
  /**
35
36
  * @returns the currently selected annotation
36
37
  */
@@ -32,6 +32,7 @@ export declare class Texts extends Editor<Text> {
32
32
  private _onInput;
33
33
  detect({ x, y }: Point, margin?: number): Text | undefined;
34
34
  draw(svg: SVGSVGElement): void;
35
+ refreshDrawing(): void;
35
36
  getDefaultOptions(): Text;
36
37
  refreshEditor(): void;
37
38
  select(id: Id): void;
@@ -16,6 +16,7 @@ export default abstract class Editor<T extends Annotation> extends eventEmmitter
16
16
  protected ogmaOptions: Options;
17
17
  protected shouldDetect: boolean;
18
18
  protected isDragging: boolean;
19
+ protected showeditorOnHover: boolean;
19
20
  protected maxHandleScale: number;
20
21
  constructor(ogma: Ogma, editorHtml: string);
21
22
  private _onKeyUp;
@@ -72,6 +73,7 @@ export default abstract class Editor<T extends Annotation> extends eventEmmitter
72
73
  */
73
74
  disableDetection(): void;
74
75
  refreshLayer(): void;
76
+ refreshDrawing(): void;
75
77
  getElements(): T[];
76
78
  abstract refreshEditor(): void;
77
79
  abstract draw(svg: SVGSVGElement): void;
@@ -16,5 +16,6 @@ export declare class Links {
16
16
  arrowIsLinked(arrowId: Id, side: Side): boolean;
17
17
  remove(arrow: Arrow, side: Side): this;
18
18
  getArrowLink(arrowId: Id, side: Side): Link | null;
19
- getTargetLinks(targetId: Id): Link[];
19
+ getTargetLinks(targetId: Id, type: TargetType): Link[];
20
+ forEach(cb: (link: Link) => void): void;
20
21
  }
@@ -40,8 +40,8 @@ export type StrokeOptions = {
40
40
  export interface TextStyle extends StrokeOptions {
41
41
  /** Helvetica, sans-serif... */
42
42
  font?: string;
43
- /** 12px, 1em... */
44
- fontSize?: string;
43
+ /** Font size, in pixels */
44
+ fontSize?: number;
45
45
  /** text color: #f00, yellow...*/
46
46
  color?: string;
47
47
  /** background color: empty for transparent #f00, yellow...*/
@@ -113,6 +113,18 @@ export type FeatureEvents = {
113
113
  arrow: Arrow;
114
114
  link: Link;
115
115
  }) => void;
116
+ /**
117
+ * Event trigerred when starting to drag an arrow or a text
118
+ */
119
+ [EVT_DRAG_START]: (evt: Arrow | Text) => void;
120
+ /**
121
+ * Event trigerred when dragging an arrow or a text
122
+ */
123
+ [EVT_DRAG]: (evt: Arrow | Text, key: 'line' | 'start' | 'end' | 'text') => void;
124
+ /**
125
+ * Event trigerred when stopped dragging an arrow or a text
126
+ */
127
+ [EVT_DRAG_END]: (evt: Arrow | Text) => void;
116
128
  };
117
129
  export type TargetType = 'text' | 'node';
118
130
  export type Side = 'start' | 'end';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linkurious/ogma-annotations",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Headless annotation plugin for Ogma",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",