@linkurious/ogma-annotations 1.1.13 → 1.1.14
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/index.js +11 -11
- package/dist/index.mjs +1034 -1483
- package/dist/style.css +1 -1
- package/dist/types/Editor/Arrows/render.d.ts +1 -1
- package/dist/types/Editor/base.d.ts +0 -1
- package/dist/types/types.d.ts +5 -1
- package/dist/types/vec.d.ts +15 -0
- package/package.json +4 -5
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
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(-
|
|
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;--handle-background: #fff}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(-55%,-55%)}.point-handle.top-right{transform:translate(-45%,-55%)}.point-handle.bottom-left{transform:translate(-55%,-45%)}.point-handle.bottom-right{transform:translate(-45%,-45%)}.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}.arrow-handle>.point{background-color:var(--handle-background);border:2px solid var(--handle-color)}.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)}.annotation-text a{fill:var(--handle-color)}.annotation-text a:hover{text-decoration:underline}
|
|
@@ -17,7 +17,6 @@ export declare abstract class Editor<T extends Annotation> extends eventEmmitter
|
|
|
17
17
|
protected shouldDetect: boolean;
|
|
18
18
|
protected isDragging: boolean;
|
|
19
19
|
protected showeditorOnHover: boolean;
|
|
20
|
-
protected maxHandleScale: number;
|
|
21
20
|
constructor(ogma: Ogma, editorHtml: string);
|
|
22
21
|
private _onKeyUp;
|
|
23
22
|
protected _canRemove(): boolean;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Point } from "@linkurious/ogma";
|
|
2
1
|
import type { Feature, FeatureCollection, Geometry, GeometryObject, LineString, Polygon } from "geojson";
|
|
3
2
|
import { EVT_ADD, EVT_CANCEL_DRAWING, EVT_DRAG, EVT_DRAG_END, EVT_DRAG_START, EVT_HOVER, EVT_REMOVE, EVT_SELECT, EVT_UNHOVER, EVT_UNSELECT, EVT_UPDATE, EVT_LINK } from "./constants";
|
|
4
3
|
export declare const isArrow: (a: AnnotationFeature<Geometry, AnnotationProps>) => a is Arrow;
|
|
@@ -17,6 +16,10 @@ export interface ArrowStyles extends StrokeOptions {
|
|
|
17
16
|
tail?: Extremity;
|
|
18
17
|
head?: Extremity;
|
|
19
18
|
}
|
|
19
|
+
export type Point = {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
20
23
|
type ExportedLink = {
|
|
21
24
|
id: Id;
|
|
22
25
|
side: "start" | "end";
|
|
@@ -184,4 +187,5 @@ export type ControllerOptions = {
|
|
|
184
187
|
maxArrowHeight: number;
|
|
185
188
|
};
|
|
186
189
|
export type Annotation = Arrow | Text;
|
|
190
|
+
export type Vector = Point;
|
|
187
191
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Vector } from "./types";
|
|
2
|
+
export declare const subtract: (a: Vector, b: Vector) => Vector;
|
|
3
|
+
export declare const length: (v: Vector) => number;
|
|
4
|
+
export declare const invert: (v: Vector) => Vector;
|
|
5
|
+
export declare const clone: (v: Vector) => {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const normalize: (v: Vector) => Vector;
|
|
10
|
+
export declare const add: (a: Vector, b: Vector) => Vector;
|
|
11
|
+
export declare const mul: (v: Vector, s: number) => Vector;
|
|
12
|
+
export declare const multiply: (a: Vector, b: Vector) => Vector;
|
|
13
|
+
export declare const rotateRadians: (v: Vector, angle: number) => Vector;
|
|
14
|
+
export declare const divScalar: (v: Vector, s: number) => Vector;
|
|
15
|
+
export declare const dot: (a: Vector, b: Vector) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkurious/ogma-annotations",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Headless annotation plugin for Ogma",
|
|
5
5
|
"main": "dist/index.mjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"prepare": "playwright install",
|
|
31
31
|
"start": "npm run dev",
|
|
32
|
-
"dev": "vite -c web/vite.config.
|
|
32
|
+
"dev": "vite -c web/vite.config.mts",
|
|
33
33
|
"build:demo": "vite build -c web/vite.config.mts",
|
|
34
34
|
"prebuild": "rm -rf dist",
|
|
35
35
|
"bump:patch": "bump2version patch && npm version --no-git-tag-version patch",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"preview": "vite preview",
|
|
43
43
|
"docs:build": "typedoc --plugin typedoc-plugin-markdown --out ../../docs/api src/index.ts",
|
|
44
44
|
"postdocs:build": "npm run build:demo",
|
|
45
|
+
"test": "npm run test:unit",
|
|
45
46
|
"test:unit": "vitest run -c test/unit/vitest.config.mts",
|
|
46
47
|
"test:watch": "vitest watch -c test/unit/vitest.config.mts",
|
|
47
48
|
"test:e2e": "vitest run -c test/e2e/vitest.config.mts",
|
|
@@ -69,13 +70,11 @@
|
|
|
69
70
|
},
|
|
70
71
|
"dependencies": {
|
|
71
72
|
"@borgar/textbox": "1.6.0",
|
|
72
|
-
"eventemitter3": "5.0.1"
|
|
73
|
-
"vector2js": "2.0.1"
|
|
73
|
+
"eventemitter3": "5.0.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@linkurious/eslint-config-ogma": "^1.0.9",
|
|
77
77
|
"@types/geojson": "7946.0.13",
|
|
78
|
-
"@types/vector2js": "2.0.2",
|
|
79
78
|
"canvas": "2.11.2",
|
|
80
79
|
"eslint": "8.56.0",
|
|
81
80
|
"get-port": "7.0.0",
|