@buerli.io/core 0.9.0-beta.1 → 0.9.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.
@@ -16,14 +16,23 @@ const selectionApi = (set, get, buerliApi) => ({
16
16
  const { selection, id: drawingId } = get();
17
17
  const selId = (selectorId || selection.active);
18
18
  if (selId) {
19
- const unselItems = selection.refs[selId].items;
19
+ const selector = selection.refs[selId];
20
+ const unselItems = selector.items;
21
+ if (unselItems.length === 0) {
22
+ return;
23
+ }
20
24
  (0, selection_1.unsubscribeItems)(buerliApi, drawingId, selId, unselItems);
21
- set(state => {
22
- const selector = state.selection.refs[selId];
23
- return {
24
- selection: Object.assign(Object.assign({}, state.selection), { refs: Object.assign(Object.assign({}, state.selection.refs), { [selId]: Object.assign(Object.assign({}, selector), { items: [] }) }) }),
25
- };
26
- });
25
+ if (selector.customUnSelect) {
26
+ selector.customUnSelect(selId, [], unselItems);
27
+ }
28
+ else {
29
+ set(state => {
30
+ const selector_ = state.selection.refs[selId];
31
+ return {
32
+ selection: Object.assign(Object.assign({}, state.selection), { refs: Object.assign(Object.assign({}, state.selection.refs), { [selId]: Object.assign(Object.assign({}, selector_), { items: [] }) }) }),
33
+ };
34
+ });
35
+ }
27
36
  }
28
37
  },
29
38
  unselect(items, selectorId) {
@@ -12,14 +12,23 @@ export const selectionApi = (set, get, buerliApi) => ({
12
12
  const { selection, id: drawingId } = get();
13
13
  const selId = (selectorId || selection.active);
14
14
  if (selId) {
15
- const unselItems = selection.refs[selId].items;
15
+ const selector = selection.refs[selId];
16
+ const unselItems = selector.items;
17
+ if (unselItems.length === 0) {
18
+ return;
19
+ }
16
20
  unsubscribeItems(buerliApi, drawingId, selId, unselItems);
17
- set(state => {
18
- const selector = state.selection.refs[selId];
19
- return {
20
- selection: Object.assign(Object.assign({}, state.selection), { refs: Object.assign(Object.assign({}, state.selection.refs), { [selId]: Object.assign(Object.assign({}, selector), { items: [] }) }) }),
21
- };
22
- });
21
+ if (selector.customUnSelect) {
22
+ selector.customUnSelect(selId, [], unselItems);
23
+ }
24
+ else {
25
+ set(state => {
26
+ const selector_ = state.selection.refs[selId];
27
+ return {
28
+ selection: Object.assign(Object.assign({}, state.selection), { refs: Object.assign(Object.assign({}, state.selection.refs), { [selId]: Object.assign(Object.assign({}, selector_), { items: [] }) }) }),
29
+ };
30
+ });
31
+ }
23
32
  }
24
33
  },
25
34
  unselect(items, selectorId) {
@@ -252,6 +252,5 @@ export declare type GeometryElement = MeshGeometry | PlaneGeometry | CylinderGeo
252
252
  export declare type ProductElement = GeometryElement & {
253
253
  productId: ObjectID;
254
254
  };
255
- export declare type AnyGeometryElement = CommonProps & Metadata & Partial<MeshGeometry> & Partial<PlaneGeometry> & Partial<CylinderGeometry> & Partial<ConeGeometry> & Partial<SphereGeometry> & Partial<LineGeometry> & Partial<EdgeGeometry> & Partial<ArcGeometry> & Partial<CircleGeometry> & Partial<PointGeometry>;
256
255
  export declare const isEqualGeometry: (a: GeometryElement, b: GeometryElement) => boolean;
257
256
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/core",
3
- "version": "0.9.0-beta.1",
3
+ "version": "0.9.0",
4
4
  "description": "buerli state management",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "license": "ISC",