@insync-stageplayer/annotations 0.5.37 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AnnotationContent.d.ts +37 -37
- package/lib/components/AnnotationContent.d.ts.map +1 -1
- package/lib/components/AnnotationContent.js +59 -59
- package/lib/components/AnnotationEditForm.d.ts +26 -26
- package/lib/components/AnnotationEditForm.js +146 -146
- package/lib/components/AnnotationsModuleProvider.d.ts +36 -36
- package/lib/components/AnnotationsModuleProvider.js +20 -20
- package/lib/components/AnnotationsViewer.d.ts +15 -15
- package/lib/components/AnnotationsViewer.js +107 -107
- package/lib/components/DraggablePosition.d.ts +31 -31
- package/lib/components/DraggablePosition.js +62 -62
- package/lib/components/MeasurementDisplayDataContext.d.ts +10 -10
- package/lib/components/MeasurementDisplayDataContext.js +2 -2
- package/lib/components/MeasurementDisplayDataProvider.d.ts +15 -15
- package/lib/components/MeasurementDisplayDataProvider.d.ts.map +1 -1
- package/lib/components/MeasurementDisplayDataProvider.js +45 -45
- package/lib/components/MeasurementDisplayDataProvider.js.map +1 -1
- package/lib/components/MeasurementDisplayEditor.d.ts +19 -19
- package/lib/components/MeasurementDisplayEditor.js +136 -136
- package/lib/components/MeasurementDisplayElement.d.ts +18 -18
- package/lib/components/MeasurementDisplayElement.d.ts.map +1 -1
- package/lib/components/MeasurementDisplayElement.js +65 -97
- package/lib/components/MeasurementDisplayElement.js.map +1 -1
- package/lib/components/ModalAnnotationEditor.d.ts +12 -12
- package/lib/components/ModalAnnotationEditor.js +37 -37
- package/lib/formatNumber.d.ts +29 -29
- package/lib/formatNumber.js +12 -12
- package/lib/hooks/useMeasurementDisplayData.d.ts +14 -14
- package/lib/hooks/useMeasurementDisplayData.js +39 -39
- package/lib/index.d.ts +8 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -7
- package/lib/index.js.map +1 -1
- package/lib/redux/actions.d.ts +1 -1
- package/lib/redux/actions.js +1 -1
- package/lib/redux/annotationEditor.slice.d.ts +40 -37
- package/lib/redux/annotationEditor.slice.d.ts.map +1 -1
- package/lib/redux/annotationEditor.slice.js +123 -122
- package/lib/redux/annotationEditor.slice.js.map +1 -1
- package/lib/redux/annotations.slice.d.ts +34 -31
- package/lib/redux/annotations.slice.d.ts.map +1 -1
- package/lib/redux/annotations.slice.js +67 -65
- package/lib/redux/annotations.slice.js.map +1 -1
- package/lib/redux/measurementDisplayEditor.slice.d.ts +16 -25
- package/lib/redux/measurementDisplayEditor.slice.d.ts.map +1 -1
- package/lib/redux/measurementDisplayEditor.slice.js +37 -36
- package/lib/redux/measurementDisplayEditor.slice.js.map +1 -1
- package/lib/redux/measurementDisplays.slice.d.ts +28 -25
- package/lib/redux/measurementDisplays.slice.d.ts.map +1 -1
- package/lib/redux/measurementDisplays.slice.js +24 -22
- package/lib/redux/measurementDisplays.slice.js.map +1 -1
- package/lib/redux/reducer.d.ts +11 -51
- package/lib/redux/reducer.d.ts.map +1 -1
- package/lib/redux/reducer.js +65 -65
- package/lib/redux/reducer.js.map +1 -1
- package/lib/useBoundingRect.d.ts +8 -8
- package/lib/useBoundingRect.js +27 -27
- package/lib/util.d.ts +5 -5
- package/lib/util.js +7 -7
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotationEditor.slice.d.ts","sourceRoot":"","sources":["../../src/redux/annotationEditor.slice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"annotationEditor.slice.d.ts","sourceRoot":"","sources":["../../src/redux/annotationEditor.slice.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,aAAK,iBAAiB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG;IAChD,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;CACxB,CAAC;AAcF,QAAA,MAAM,kBAAkB,gBAAiB,iBAAiB;IACxD;;OAEG;;IAEH;;;OAGG;;;;;IAKH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEH,CAAC;AAyFH,eAAO,MACL,UAAU,sHACV,aAAa,iGACb,eAAe,8FACf,qBAAqB,yGACrB,sBAAsB,0GACtB,oBAAoB,mGACpB,qBAAqB,oGACrB,mBAAmB,sGACnB,WAAW,+FACX,oBAAoB,iGACW,CAAC;AAElC,oBAAY,qBAAqB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE1E,QAAA,MAAM,uBAAuB,EAAE,OAAO,CAAC,qBAAqB,CAC7B,CAAC;AAEhC,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,123 +1,124 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contains the "slice" of state for the annotation editor.
|
|
3
|
-
*/
|
|
4
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
5
|
-
import { diff } from "deep-diff";
|
|
6
|
-
const defaultAnnotation = {
|
|
7
|
-
id: undefined,
|
|
8
|
-
// This has to be added, and is interpreted as an empty value. If you provide undefined, you'll be presented with unexpected behaviour.
|
|
9
|
-
content: [
|
|
10
|
-
{
|
|
11
|
-
type: "paragraph",
|
|
12
|
-
children: [{ text: "" }],
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
position: { x: 0, y: 0 },
|
|
16
|
-
};
|
|
17
|
-
const createInitialState = (annotation) => ({
|
|
18
|
-
/**
|
|
19
|
-
* The current annotation being edited.
|
|
20
|
-
*/
|
|
21
|
-
annotation: annotation || defaultAnnotation,
|
|
22
|
-
/**
|
|
23
|
-
* The current displays added to the editor. We're tracking this so they can be added or deleted
|
|
24
|
-
* depending on whether the editor is submitted or cancelled.
|
|
25
|
-
*/
|
|
26
|
-
displays: {
|
|
27
|
-
added: [],
|
|
28
|
-
deleted: [],
|
|
29
|
-
},
|
|
30
|
-
/**
|
|
31
|
-
* When set to true, will show a measurement chooser.
|
|
32
|
-
*/
|
|
33
|
-
pickingMeasurement: false,
|
|
34
|
-
/**
|
|
35
|
-
* The measurement chosen in the measurement chooser.
|
|
36
|
-
*/
|
|
37
|
-
chosenMeasurement: null,
|
|
38
|
-
/**
|
|
39
|
-
* An error that might have ocurred while selecting a measurement.
|
|
40
|
-
*/
|
|
41
|
-
pickingMeasurementError: null,
|
|
42
|
-
/**
|
|
43
|
-
* The MeasurementDisplay currently being editted.
|
|
44
|
-
*/
|
|
45
|
-
editingMeasurementDisplay: null,
|
|
46
|
-
});
|
|
47
|
-
const annotationEditorSlice = createSlice({
|
|
48
|
-
name: "annotationEditor",
|
|
49
|
-
initialState: createInitialState(),
|
|
50
|
-
reducers: {
|
|
51
|
-
initEditor: (state, action) => {
|
|
52
|
-
state.pickingMeasurement = false;
|
|
53
|
-
state.pickingMeasurementError = null;
|
|
54
|
-
state.chosenMeasurement = null;
|
|
55
|
-
state.editingMeasurementDisplay = null;
|
|
56
|
-
state.annotation = action.payload || defaultAnnotation;
|
|
57
|
-
state.displays = {
|
|
58
|
-
added: [],
|
|
59
|
-
deleted: [],
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
updateContent: (state, action) => {
|
|
63
|
-
const newContent = action.payload;
|
|
64
|
-
// Make a deep clone of the content.
|
|
65
|
-
const oldContent = JSON.parse(JSON.stringify(state.annotation.content));
|
|
66
|
-
const difference = diff(oldContent, newContent) || [];
|
|
67
|
-
// This compares the difference between the old content and new content, and checks
|
|
68
|
-
// if any measurement displays where created or deleted. We need to keep track of these
|
|
69
|
-
// because according to what happens with the editing annotation after the form is finished,
|
|
70
|
-
// we might have to delete measurement displays.
|
|
71
|
-
state.displays = difference.reduce((acc, c) => {
|
|
72
|
-
// Detect any deleted measurementDisplays.
|
|
73
|
-
if (c.kind === "A" &&
|
|
74
|
-
c.item.kind === "D" &&
|
|
75
|
-
c.item.lhs.type === "measurementDisplay") {
|
|
76
|
-
acc.deleted.push(c.item.lhs.measurementDisplayId);
|
|
77
|
-
acc.added.splice(acc.added.indexOf(c.item.lhs.measurementDisplayId), 1);
|
|
78
|
-
}
|
|
79
|
-
// Detect any added measurementDisplays.
|
|
80
|
-
if (c.kind === "A" &&
|
|
81
|
-
c.item.kind === "N" &&
|
|
82
|
-
c.item.rhs.type === "measurementDisplay") {
|
|
83
|
-
acc.added.push(c.item.rhs.measurementDisplayId);
|
|
84
|
-
}
|
|
85
|
-
return acc;
|
|
86
|
-
}, state.displays);
|
|
87
|
-
state.annotation.content = action.payload;
|
|
88
|
-
},
|
|
89
|
-
pickMeasurement: (state) => {
|
|
90
|
-
state.pickingMeasurement = true;
|
|
91
|
-
state.chosenMeasurement = null;
|
|
92
|
-
state.pickingMeasurementError = null;
|
|
93
|
-
},
|
|
94
|
-
pickMeasurementSuccess: (state, action) => {
|
|
95
|
-
state.editingMeasurementDisplay = action.payload;
|
|
96
|
-
state.pickingMeasurement = false;
|
|
97
|
-
state.chosenMeasurement = null;
|
|
98
|
-
},
|
|
99
|
-
pickMeasurementClose: (state) => {
|
|
100
|
-
state.pickingMeasurement = false;
|
|
101
|
-
state.chosenMeasurement = null;
|
|
102
|
-
},
|
|
103
|
-
pickMeasurementSubmit: (state) => {
|
|
104
|
-
state.pickingMeasurement = false;
|
|
105
|
-
},
|
|
106
|
-
pickMeasurementChoose: (state, action) => {
|
|
107
|
-
state.chosenMeasurement = action.payload;
|
|
108
|
-
},
|
|
109
|
-
pickMeasurementFail: (state, action) => {
|
|
110
|
-
state.pickingMeasurement = false;
|
|
111
|
-
state.pickingMeasurementError = action.payload;
|
|
112
|
-
},
|
|
113
|
-
editDisplay: (state, action) => {
|
|
114
|
-
state.editingMeasurementDisplay = action.payload;
|
|
115
|
-
},
|
|
116
|
-
finishEditingDisplay: (state) => {
|
|
117
|
-
state.editingMeasurementDisplay = null;
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
export const { initEditor, updateContent, pickMeasurement, pickMeasurementChoose, pickMeasurementSuccess, pickMeasurementClose, pickMeasurementSubmit, pickMeasurementFail, editDisplay, finishEditingDisplay, } = annotationEditorSlice.actions;
|
|
122
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Contains the "slice" of state for the annotation editor.
|
|
3
|
+
*/
|
|
4
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
5
|
+
import { diff } from "deep-diff";
|
|
6
|
+
const defaultAnnotation = {
|
|
7
|
+
id: undefined,
|
|
8
|
+
// This has to be added, and is interpreted as an empty value. If you provide undefined, you'll be presented with unexpected behaviour.
|
|
9
|
+
content: [
|
|
10
|
+
{
|
|
11
|
+
type: "paragraph",
|
|
12
|
+
children: [{ text: "" }],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
position: { x: 0, y: 0 },
|
|
16
|
+
};
|
|
17
|
+
const createInitialState = (annotation) => ({
|
|
18
|
+
/**
|
|
19
|
+
* The current annotation being edited.
|
|
20
|
+
*/
|
|
21
|
+
annotation: annotation || defaultAnnotation,
|
|
22
|
+
/**
|
|
23
|
+
* The current displays added to the editor. We're tracking this so they can be added or deleted
|
|
24
|
+
* depending on whether the editor is submitted or cancelled.
|
|
25
|
+
*/
|
|
26
|
+
displays: {
|
|
27
|
+
added: [],
|
|
28
|
+
deleted: [],
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* When set to true, will show a measurement chooser.
|
|
32
|
+
*/
|
|
33
|
+
pickingMeasurement: false,
|
|
34
|
+
/**
|
|
35
|
+
* The measurement chosen in the measurement chooser.
|
|
36
|
+
*/
|
|
37
|
+
chosenMeasurement: null,
|
|
38
|
+
/**
|
|
39
|
+
* An error that might have ocurred while selecting a measurement.
|
|
40
|
+
*/
|
|
41
|
+
pickingMeasurementError: null,
|
|
42
|
+
/**
|
|
43
|
+
* The MeasurementDisplay currently being editted.
|
|
44
|
+
*/
|
|
45
|
+
editingMeasurementDisplay: null,
|
|
46
|
+
});
|
|
47
|
+
const annotationEditorSlice = createSlice({
|
|
48
|
+
name: "annotationEditor",
|
|
49
|
+
initialState: createInitialState(),
|
|
50
|
+
reducers: {
|
|
51
|
+
initEditor: (state, action) => {
|
|
52
|
+
state.pickingMeasurement = false;
|
|
53
|
+
state.pickingMeasurementError = null;
|
|
54
|
+
state.chosenMeasurement = null;
|
|
55
|
+
state.editingMeasurementDisplay = null;
|
|
56
|
+
state.annotation = action.payload || defaultAnnotation;
|
|
57
|
+
state.displays = {
|
|
58
|
+
added: [],
|
|
59
|
+
deleted: [],
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
updateContent: (state, action) => {
|
|
63
|
+
const newContent = action.payload;
|
|
64
|
+
// Make a deep clone of the content.
|
|
65
|
+
const oldContent = JSON.parse(JSON.stringify(state.annotation.content));
|
|
66
|
+
const difference = diff(oldContent, newContent) || [];
|
|
67
|
+
// This compares the difference between the old content and new content, and checks
|
|
68
|
+
// if any measurement displays where created or deleted. We need to keep track of these
|
|
69
|
+
// because according to what happens with the editing annotation after the form is finished,
|
|
70
|
+
// we might have to delete measurement displays.
|
|
71
|
+
state.displays = difference.reduce((acc, c) => {
|
|
72
|
+
// Detect any deleted measurementDisplays.
|
|
73
|
+
if (c.kind === "A" &&
|
|
74
|
+
c.item.kind === "D" &&
|
|
75
|
+
c.item.lhs.type === "measurementDisplay") {
|
|
76
|
+
acc.deleted.push(c.item.lhs.measurementDisplayId);
|
|
77
|
+
acc.added.splice(acc.added.indexOf(c.item.lhs.measurementDisplayId), 1);
|
|
78
|
+
}
|
|
79
|
+
// Detect any added measurementDisplays.
|
|
80
|
+
if (c.kind === "A" &&
|
|
81
|
+
c.item.kind === "N" &&
|
|
82
|
+
c.item.rhs.type === "measurementDisplay") {
|
|
83
|
+
acc.added.push(c.item.rhs.measurementDisplayId);
|
|
84
|
+
}
|
|
85
|
+
return acc;
|
|
86
|
+
}, state.displays);
|
|
87
|
+
state.annotation.content = action.payload;
|
|
88
|
+
},
|
|
89
|
+
pickMeasurement: (state) => {
|
|
90
|
+
state.pickingMeasurement = true;
|
|
91
|
+
state.chosenMeasurement = null;
|
|
92
|
+
state.pickingMeasurementError = null;
|
|
93
|
+
},
|
|
94
|
+
pickMeasurementSuccess: (state, action) => {
|
|
95
|
+
state.editingMeasurementDisplay = action.payload;
|
|
96
|
+
state.pickingMeasurement = false;
|
|
97
|
+
state.chosenMeasurement = null;
|
|
98
|
+
},
|
|
99
|
+
pickMeasurementClose: (state) => {
|
|
100
|
+
state.pickingMeasurement = false;
|
|
101
|
+
state.chosenMeasurement = null;
|
|
102
|
+
},
|
|
103
|
+
pickMeasurementSubmit: (state) => {
|
|
104
|
+
state.pickingMeasurement = false;
|
|
105
|
+
},
|
|
106
|
+
pickMeasurementChoose: (state, action) => {
|
|
107
|
+
state.chosenMeasurement = action.payload;
|
|
108
|
+
},
|
|
109
|
+
pickMeasurementFail: (state, action) => {
|
|
110
|
+
state.pickingMeasurement = false;
|
|
111
|
+
state.pickingMeasurementError = action.payload;
|
|
112
|
+
},
|
|
113
|
+
editDisplay: (state, action) => {
|
|
114
|
+
state.editingMeasurementDisplay = action.payload;
|
|
115
|
+
},
|
|
116
|
+
finishEditingDisplay: (state) => {
|
|
117
|
+
state.editingMeasurementDisplay = null;
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
export const { initEditor, updateContent, pickMeasurement, pickMeasurementChoose, pickMeasurementSuccess, pickMeasurementClose, pickMeasurementSubmit, pickMeasurementFail, editDisplay, finishEditingDisplay, } = annotationEditorSlice.actions;
|
|
122
|
+
const annotationEditorReducer = annotationEditorSlice.reducer;
|
|
123
|
+
export default annotationEditorReducer;
|
|
123
124
|
//# sourceMappingURL=annotationEditor.slice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotationEditor.slice.js","sourceRoot":"","sources":["../../src/redux/annotationEditor.slice.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,W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,WAAW,EAAE,CAAC,KAAK,EAAE,MAA6B,EAAE,EAAE;YACpD,KAAK,CAAC,yBAAyB,GAAG,MAAM,CAAC,OAAO,CAAC;QACnD,CAAC;QACD,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;YAC9B,KAAK,CAAC,yBAAyB,GAAG,IAAI,CAAC;QACzC,CAAC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EACX,UAAU,EACV,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,oBAAoB,GACrB,GAAG,qBAAqB,CAAC,OAAO,CAAC;AAIlC,MAAM,uBAAuB,GAC3B,qBAAqB,CAAC,OAAO,CAAC;AAEhC,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import { Node } from "slate";
|
|
2
|
-
import { Position2D } from "@insync-stageplayer/common";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export declare const
|
|
28
|
-
declare const
|
|
29
|
-
editingAnnotation: string | undefined;
|
|
30
|
-
}
|
|
31
|
-
export
|
|
1
|
+
import { Node } from "slate";
|
|
2
|
+
import { Position2D } from "@insync-stageplayer/common";
|
|
3
|
+
import { Reducer } from "redux";
|
|
4
|
+
/**
|
|
5
|
+
* An annotation that can be placed on a 2D surface
|
|
6
|
+
*/
|
|
7
|
+
export declare type Annotation = {
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The position {x, y} of the annotation.
|
|
11
|
+
*/
|
|
12
|
+
position: Position2D;
|
|
13
|
+
/**
|
|
14
|
+
* The content of the annotation, this is a slate js node.
|
|
15
|
+
*/
|
|
16
|
+
content?: Node[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Checks if an argument is a valid annotation.
|
|
20
|
+
* @param arg
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare function isAnnotation(arg: unknown): arg is Annotation;
|
|
24
|
+
/**
|
|
25
|
+
* Please read up https://redux-toolkit.js.org/usage/usage-with-typescript#createentityadapter to understand what this is.
|
|
26
|
+
*/
|
|
27
|
+
export declare const annotationsAdapter: import("@reduxjs/toolkit").EntityAdapter<Annotation, string>;
|
|
28
|
+
declare const initialState: import("@reduxjs/toolkit").EntityState<Annotation, string> & {
|
|
29
|
+
editingAnnotation: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare const editAnnotation: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "annotations/editAnnotation">, editAnnotationCancel: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"annotations/editAnnotationCancel">, editAnnotationSubmit: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "annotations/editAnnotationSubmit">, editAnnotationDelete: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"annotations/editAnnotationDelete">, createAnnotation: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "annotations/createAnnotation">, createAnnotations: import("@reduxjs/toolkit").ActionCreatorWithPayload<Record<string, Annotation> | readonly Annotation[], "annotations/createAnnotations">, updateAnnotation: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("@reduxjs/toolkit").Update<Annotation, string>, "annotations/updateAnnotation">, deleteAnnotation: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "annotations/deleteAnnotation">;
|
|
32
|
+
export declare type AnnotationsState = typeof initialState;
|
|
33
|
+
declare const annotationsReducer: Reducer<AnnotationsState>;
|
|
34
|
+
export default annotationsReducer;
|
|
32
35
|
//# sourceMappingURL=annotations.slice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.slice.d.ts","sourceRoot":"","sources":["../../src/redux/annotations.slice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAGL,UAAU,EACX,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"annotations.slice.d.ts","sourceRoot":"","sources":["../../src/redux/annotations.slice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAGL,UAAU,EACX,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,CAO5D;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,8DAAoC,CAAC;AAkBpE,QAAA,MAAM,YAAY;;CAEhB,CAAC;AAmCH,eAAO,MACL,cAAc,6FACd,oBAAoB,8FACpB,oBAAoB,gGACpB,oBAAoB,8FACpB,gBAAgB,+FAChB,iBAAiB,4IACjB,gBAAgB,8IAChB,gBAAgB,6FACU,CAAC;AAE7B,oBAAY,gBAAgB,GAAG,OAAO,YAAY,CAAC;AAEnD,QAAA,MAAM,kBAAkB,EAAE,OAAO,CAAC,gBAAgB,CAA4B,CAAC;AAE/E,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,66 +1,68 @@
|
|
|
1
|
-
import { isPosition2D, isUnknownObject, } from "@insync-stageplayer/common";
|
|
2
|
-
import { createEntityAdapter, createSlice, } from "@reduxjs/toolkit";
|
|
3
|
-
/**
|
|
4
|
-
* Checks if an argument is a valid annotation.
|
|
5
|
-
* @param arg
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export function isAnnotation(arg) {
|
|
9
|
-
return (isUnknownObject(arg) &&
|
|
10
|
-
typeof arg.id === "string" &&
|
|
11
|
-
Array.isArray(arg.content) &&
|
|
12
|
-
isPosition2D(arg.position));
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Please read up https://redux-toolkit.js.org/usage/usage-with-typescript#createentityadapter to understand what this is.
|
|
16
|
-
*/
|
|
17
|
-
export const annotationsAdapter = createEntityAdapter();
|
|
18
|
-
const defaultAnnotation = {
|
|
19
|
-
/**
|
|
20
|
-
* Place the annotation in the center of the plane.
|
|
21
|
-
*/
|
|
22
|
-
position: {
|
|
23
|
-
x: 0.5,
|
|
24
|
-
y: 0.5,
|
|
25
|
-
},
|
|
26
|
-
content: [
|
|
27
|
-
{
|
|
28
|
-
type: "paragraph",
|
|
29
|
-
children: [{ text: "" }],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
state.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
state
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export
|
|
1
|
+
import { isPosition2D, isUnknownObject, } from "@insync-stageplayer/common";
|
|
2
|
+
import { createEntityAdapter, createSlice, } from "@reduxjs/toolkit";
|
|
3
|
+
/**
|
|
4
|
+
* Checks if an argument is a valid annotation.
|
|
5
|
+
* @param arg
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export function isAnnotation(arg) {
|
|
9
|
+
return (isUnknownObject(arg) &&
|
|
10
|
+
typeof arg.id === "string" &&
|
|
11
|
+
Array.isArray(arg.content) &&
|
|
12
|
+
isPosition2D(arg.position));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Please read up https://redux-toolkit.js.org/usage/usage-with-typescript#createentityadapter to understand what this is.
|
|
16
|
+
*/
|
|
17
|
+
export const annotationsAdapter = createEntityAdapter();
|
|
18
|
+
const defaultAnnotation = {
|
|
19
|
+
/**
|
|
20
|
+
* Place the annotation in the center of the plane.
|
|
21
|
+
*/
|
|
22
|
+
position: {
|
|
23
|
+
x: 0.5,
|
|
24
|
+
y: 0.5,
|
|
25
|
+
},
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: "paragraph",
|
|
29
|
+
children: [{ text: "" }],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
const initialState = annotationsAdapter.getInitialState({
|
|
34
|
+
editingAnnotation: undefined,
|
|
35
|
+
});
|
|
36
|
+
const annotationsSlice = createSlice({
|
|
37
|
+
name: "annotations",
|
|
38
|
+
initialState,
|
|
39
|
+
reducers: {
|
|
40
|
+
createAnnotations: annotationsAdapter.addMany,
|
|
41
|
+
updateAnnotation: annotationsAdapter.updateOne,
|
|
42
|
+
deleteAnnotation: annotationsAdapter.removeOne,
|
|
43
|
+
createAnnotation: (state, action) => {
|
|
44
|
+
annotationsAdapter.addOne(state, Object.assign({ id: action.payload }, defaultAnnotation));
|
|
45
|
+
state.editingAnnotation = action.payload;
|
|
46
|
+
},
|
|
47
|
+
editAnnotation: (state, action) => {
|
|
48
|
+
state.editingAnnotation = action.payload;
|
|
49
|
+
},
|
|
50
|
+
editAnnotationCancel: (state) => {
|
|
51
|
+
state.editingAnnotation = undefined;
|
|
52
|
+
},
|
|
53
|
+
editAnnotationSubmit: (state, action) => {
|
|
54
|
+
annotationsAdapter.upsertOne(state, action);
|
|
55
|
+
state.editingAnnotation = undefined;
|
|
56
|
+
},
|
|
57
|
+
editAnnotationDelete: (state) => {
|
|
58
|
+
if (state.editingAnnotation) {
|
|
59
|
+
annotationsAdapter.removeOne(state, state.editingAnnotation);
|
|
60
|
+
}
|
|
61
|
+
state.editingAnnotation = undefined;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
export const { editAnnotation, editAnnotationCancel, editAnnotationSubmit, editAnnotationDelete, createAnnotation, createAnnotations, updateAnnotation, deleteAnnotation, } = annotationsSlice.actions;
|
|
66
|
+
const annotationsReducer = annotationsSlice.reducer;
|
|
67
|
+
export default annotationsReducer;
|
|
66
68
|
//# sourceMappingURL=annotations.slice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.slice.js","sourceRoot":"","sources":["../../src/redux/annotations.slice.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,eAAe,GAEhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,WAAW,GAEZ,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"annotations.slice.js","sourceRoot":"","sources":["../../src/redux/annotations.slice.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,eAAe,GAEhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,WAAW,GAEZ,MAAM,kBAAkB,CAAC;AAkB1B;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,OAAO,CACL,eAAe,CAAC,GAAG,CAAC;QACpB,OAAO,GAAG,CAAC,EAAE,KAAK,QAAQ;QAC1B,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;QAC1B,YAAY,CAAC,GAAG,CAAC,QAAQ,CA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AAK,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACtC,CAAC;QACD,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,iBAAiB,EAAE;gBAC3B,kBAAkB,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;aAC9D;YACD,KAAK,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACtC,CAAC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EACX,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAI7B,MAAM,kBAAkB,GAA8B,gBAAgB,CAAC,OAAO,CAAC;AAE/E,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* Keeps track of the displays we deleted, if the form is submitted, we can delete these.
|
|
18
|
-
*/
|
|
19
|
-
deletedDisplays: string[];
|
|
20
|
-
/**
|
|
21
|
-
* Keeps track of displays we created, if the form is cancelled, we can remove all created displays.
|
|
22
|
-
*/
|
|
23
|
-
createdDisplays: string[];
|
|
24
|
-
}, import("redux").AnyAction>;
|
|
25
|
-
export default _default;
|
|
1
|
+
import { Reducer } from "redux";
|
|
2
|
+
declare const initialState: {
|
|
3
|
+
editingDisplay: string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Keeps track of the displays we deleted, if the form is submitted, we can delete these.
|
|
6
|
+
*/
|
|
7
|
+
deletedDisplays: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Keeps track of displays we created, if the form is cancelled, we can remove all created displays.
|
|
10
|
+
*/
|
|
11
|
+
createdDisplays: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const editMeasurementDisplay: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "measurementDisplayEditor/editMeasurementDisplay">, finishEditMeasurementDisplay: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"measurementDisplayEditor/finishEditMeasurementDisplay">;
|
|
14
|
+
export declare type MeasurementDisplayEditorState = typeof initialState;
|
|
15
|
+
declare const measurementDisplayEditorReducer: Reducer<MeasurementDisplayEditorState>;
|
|
16
|
+
export default measurementDisplayEditorReducer;
|
|
26
17
|
//# sourceMappingURL=measurementDisplayEditor.slice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measurementDisplayEditor.slice.d.ts","sourceRoot":"","sources":["../../src/redux/measurementDisplayEditor.slice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"measurementDisplayEditor.slice.d.ts","sourceRoot":"","sources":["../../src/redux/measurementDisplayEditor.slice.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,QAAA,MAAM,YAAY;;IAEhB;;OAEG;;IAEH;;OAEG;;CAEJ,CAAC;AAyBF,eAAO,MAAQ,sBAAsB,kHAAE,4BAA4B,iHAC5B,CAAC;AAExC,oBAAY,6BAA6B,GAAG,OAAO,YAAY,CAAC;AAEhE,QAAA,MAAM,+BAA+B,EAAE,OAAO,CAAC,6BAA6B,CACrC,CAAC;AAExC,eAAe,+BAA+B,CAAC"}
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
-
const initialState = {
|
|
3
|
-
editingDisplay: undefined,
|
|
4
|
-
/**
|
|
5
|
-
* Keeps track of the displays we deleted, if the form is submitted, we can delete these.
|
|
6
|
-
*/
|
|
7
|
-
deletedDisplays: [],
|
|
8
|
-
/**
|
|
9
|
-
* Keeps track of displays we created, if the form is cancelled, we can remove all created displays.
|
|
10
|
-
*/
|
|
11
|
-
createdDisplays: [],
|
|
12
|
-
};
|
|
13
|
-
const measurementDisplayEditorSlice = createSlice({
|
|
14
|
-
name: "measurementDisplayEditor",
|
|
15
|
-
initialState,
|
|
16
|
-
reducers: {
|
|
17
|
-
editMeasurementDisplay: (state, action) => {
|
|
18
|
-
state.editingDisplay = action.payload;
|
|
19
|
-
},
|
|
20
|
-
deleteMeasurementDisplay: (state, action) => {
|
|
21
|
-
state.deletedDisplays.push(action.payload);
|
|
22
|
-
},
|
|
23
|
-
finishEditMeasurementDisplay: (state) => {
|
|
24
|
-
state.editingDisplay = undefined;
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
extraReducers: (builder) => {
|
|
28
|
-
/*
|
|
29
|
-
builder.addCase(finishEditAnnotation, (state, action) => {
|
|
30
|
-
state.editingDisplay = undefined;
|
|
31
|
-
});
|
|
32
|
-
*/
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
export const { editMeasurementDisplay, finishEditMeasurementDisplay } = measurementDisplayEditorSlice.actions;
|
|
36
|
-
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
+
const initialState = {
|
|
3
|
+
editingDisplay: undefined,
|
|
4
|
+
/**
|
|
5
|
+
* Keeps track of the displays we deleted, if the form is submitted, we can delete these.
|
|
6
|
+
*/
|
|
7
|
+
deletedDisplays: [],
|
|
8
|
+
/**
|
|
9
|
+
* Keeps track of displays we created, if the form is cancelled, we can remove all created displays.
|
|
10
|
+
*/
|
|
11
|
+
createdDisplays: [],
|
|
12
|
+
};
|
|
13
|
+
const measurementDisplayEditorSlice = createSlice({
|
|
14
|
+
name: "measurementDisplayEditor",
|
|
15
|
+
initialState,
|
|
16
|
+
reducers: {
|
|
17
|
+
editMeasurementDisplay: (state, action) => {
|
|
18
|
+
state.editingDisplay = action.payload;
|
|
19
|
+
},
|
|
20
|
+
deleteMeasurementDisplay: (state, action) => {
|
|
21
|
+
state.deletedDisplays.push(action.payload);
|
|
22
|
+
},
|
|
23
|
+
finishEditMeasurementDisplay: (state) => {
|
|
24
|
+
state.editingDisplay = undefined;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
extraReducers: (builder) => {
|
|
28
|
+
/*
|
|
29
|
+
builder.addCase(finishEditAnnotation, (state, action) => {
|
|
30
|
+
state.editingDisplay = undefined;
|
|
31
|
+
});
|
|
32
|
+
*/
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
export const { editMeasurementDisplay, finishEditMeasurementDisplay } = measurementDisplayEditorSlice.actions;
|
|
36
|
+
const measurementDisplayEditorReducer = measurementDisplayEditorSlice.reducer;
|
|
37
|
+
export default measurementDisplayEditorReducer;
|
|
37
38
|
//# sourceMappingURL=measurementDisplayEditor.slice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measurementDisplayEditor.slice.js","sourceRoot":"","sources":["../../src/redux/measurementDisplayEditor.slice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"measurementDisplayEditor.slice.js","sourceRoot":"","sources":["../../src/redux/measurementDisplayEditor.slice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAG9D,MAAM,YAAY,GAAG;IACnB,cAAc,EAAE,SAA+B;IAC/C;;OAEG;IACH,eAAe,EAAE,EAAc;IAC/B;;OAEG;IACH,eAAe,EAAE,EAAc;CAChC,CAAC;AAEF,MAAM,6BAA6B,GAAG,WAAW,CAAC;IAChD,IAAI,EAAE,0BAA0B;IAChC,YAAY;IACZ,QAAQ,EAAE;QACR,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAA6B,EAAE,EAAE;YAC/D,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC;QACxC,CAAC;QACD,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAA6B,EAAE,EAAE;YACjE,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,4BAA4B,EAAE,CAAC,KAAK,EAAE,EAAE;YACtC,KAAK,CAAC,cAAc,GAAG,SAAS,CAAC;QACnC,CAAC;KACF;IACD,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE;QACzB;;;;UAIE;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,GACnE,6BAA6B,CAAC,OAAO,CAAC;AAIxC,MAAM,+BAA+B,GACnC,6BAA6B,CAAC,OAAO,CAAC;AAExC,eAAe,+BAA+B,CAAC"}
|