@twinmatrix/spatialverse-sdk-web 0.0.4 → 0.0.5

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.
Files changed (32) hide show
  1. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js +293 -0
  2. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js.map +1 -0
  3. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js +35 -0
  4. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js.map +1 -0
  5. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js +33 -0
  6. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js.map +1 -0
  7. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js +307 -0
  8. package/lib/cjs/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js.map +1 -0
  9. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/focustree.json +121 -0
  10. package/lib/cjs/meta-atlas-sdk/MetaAtlasCore/whatTaxonomies.json +170 -0
  11. package/lib/cjs/meta-atlas-sdk/combined_style.json +2313 -0
  12. package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js +166 -0
  13. package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js.map +1 -0
  14. package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js +229 -0
  15. package/lib/cjs/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js.map +1 -0
  16. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js +286 -0
  17. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraSync.js.map +1 -0
  18. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js +27 -0
  19. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/CameraUtils.js.map +1 -0
  20. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js +27 -0
  21. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/constants.js.map +1 -0
  22. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js +305 -0
  23. package/lib/esm/meta-atlas-sdk/3DMap/CustomThreeJsWrapper/utility/suncalc.js.map +1 -0
  24. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/focustree.json +121 -0
  25. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/meta-atlas-sdk-core.js +2 -2
  26. package/lib/esm/meta-atlas-sdk/MetaAtlasCore/whatTaxonomies.json +170 -0
  27. package/lib/esm/meta-atlas-sdk/combined_style.json +2313 -0
  28. package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js +158 -0
  29. package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js.map +1 -0
  30. package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js +221 -0
  31. package/lib/esm/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js.map +1 -0
  32. package/package.json +3 -3
@@ -0,0 +1,158 @@
1
+ import * as CommonSelectors from '@mapbox/mapbox-gl-draw/src/lib/common_selectors';
2
+ import isEventAtCoordinates from '@mapbox/mapbox-gl-draw/src/lib/is_event_at_coordinates';
3
+ import doubleClickZoom from '@mapbox/mapbox-gl-draw/src/lib/double_click_zoom';
4
+ import * as Constants from '@mapbox/mapbox-gl-draw/src/constants';
5
+ import createVertex from '@mapbox/mapbox-gl-draw/src/lib/create_vertex';
6
+ const DrawMarker = {};
7
+ DrawMarker.onSetup = function (opts) {
8
+ opts = opts || {};
9
+ const featureId = opts.featureId;
10
+ let line, currentVertexPosition;
11
+ let direction = 'forward';
12
+ if (featureId) {
13
+ line = this.getFeature(featureId);
14
+ if (!line) {
15
+ throw new Error('Could not find a feature with the provided featureId');
16
+ }
17
+ let from = opts.from;
18
+ if (from && from.type === 'Feature' && from.geometry && from.geometry.type === 'Point') {
19
+ from = from.geometry;
20
+ }
21
+ if (from && from.type === 'Point' && from.coordinates && from.coordinates.length === 2) {
22
+ from = from.coordinates;
23
+ }
24
+ if (!from || !Array.isArray(from)) {
25
+ throw new Error('Please use the `from` property to indicate which point to continue the line from');
26
+ }
27
+ const lastCoord = line.coordinates.length - 1;
28
+ if (line.coordinates[lastCoord][0] === from[0] && line.coordinates[lastCoord][1] === from[1]) {
29
+ currentVertexPosition = lastCoord + 1;
30
+ // add one new coordinate to continue from
31
+ line.addCoordinate(currentVertexPosition, ...line.coordinates[lastCoord]);
32
+ } else if (line.coordinates[0][0] === from[0] && line.coordinates[0][1] === from[1]) {
33
+ direction = 'backwards';
34
+ currentVertexPosition = 0;
35
+ // add one new coordinate to continue from
36
+ line.addCoordinate(currentVertexPosition, ...line.coordinates[0]);
37
+ } else {
38
+ throw new Error('`from` should match the point at either the start or the end of the provided LineString');
39
+ }
40
+ } else {
41
+ line = this.newFeature({
42
+ type: Constants.geojsonTypes.FEATURE,
43
+ properties: {
44
+ marker: true
45
+ },
46
+ geometry: {
47
+ type: Constants.geojsonTypes.LINE_STRING,
48
+ coordinates: []
49
+ }
50
+ });
51
+ currentVertexPosition = 0;
52
+ this.addFeature(line);
53
+ }
54
+ this.clearSelectedFeatures();
55
+ doubleClickZoom.disable(this);
56
+ this.updateUIClasses({
57
+ mouse: Constants.cursors.ADD
58
+ });
59
+ this.activateUIButton(Constants.types.LINE);
60
+ this.setActionableState({
61
+ trash: true
62
+ });
63
+ return {
64
+ line,
65
+ currentVertexPosition,
66
+ direction
67
+ };
68
+ };
69
+ DrawMarker.clickAnywhere = function (state, e) {
70
+ if (state.currentVertexPosition > 0 && isEventAtCoordinates(e, state.line.coordinates[state.currentVertexPosition - 1]) || state.direction === 'backwards' && isEventAtCoordinates(e, state.line.coordinates[state.currentVertexPosition + 1])) {
71
+ return this.changeMode(Constants.modes.SIMPLE_SELECT, {
72
+ featureIds: [state.line.id]
73
+ });
74
+ }
75
+ this.updateUIClasses({
76
+ mouse: Constants.cursors.ADD
77
+ });
78
+ state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);
79
+ if (state.direction === 'forward') {
80
+ state.currentVertexPosition++;
81
+ state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);
82
+ } else {
83
+ state.line.addCoordinate(0, e.lngLat.lng, e.lngLat.lat);
84
+ }
85
+ state.line.addCoordinate(0, e.lngLat.lng + 0.00001, e.lngLat.lat);
86
+ return this.changeMode(Constants.modes.SIMPLE_SELECT, {
87
+ featureIds: [state.line.id]
88
+ });
89
+ };
90
+ DrawMarker.clickOnVertex = function (state) {
91
+ return this.changeMode(Constants.modes.SIMPLE_SELECT, {
92
+ featureIds: [state.line.id]
93
+ });
94
+ };
95
+ DrawMarker.onMouseMove = function (state, e) {
96
+ state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);
97
+ if (CommonSelectors.isVertex(e)) {
98
+ this.updateUIClasses({
99
+ mouse: Constants.cursors.POINTER
100
+ });
101
+ }
102
+ };
103
+ DrawMarker.onTap = DrawMarker.onClick = function (state, e) {
104
+ if (CommonSelectors.isVertex(e)) return this.clickOnVertex(state, e);
105
+ this.clickAnywhere(state, e);
106
+ };
107
+ DrawMarker.onKeyUp = function (state, e) {
108
+ if (CommonSelectors.isEnterKey(e)) {
109
+ this.changeMode(Constants.modes.SIMPLE_SELECT, {
110
+ featureIds: [state.line.id]
111
+ });
112
+ } else if (CommonSelectors.isEscapeKey(e)) {
113
+ this.deleteFeature([state.line.id], {
114
+ silent: true
115
+ });
116
+ this.changeMode(Constants.modes.SIMPLE_SELECT);
117
+ }
118
+ };
119
+ DrawMarker.onStop = function (state) {
120
+ doubleClickZoom.enable(this);
121
+ this.activateUIButton();
122
+
123
+ // check to see if we've deleted this feature
124
+ if (this.getFeature(state.line.id) === undefined) return;
125
+
126
+ //remove last added coordinate
127
+ state.line.removeCoordinate("".concat(state.currentVertexPosition));
128
+ if (state.line.isValid()) {
129
+ this.map.fire(Constants.events.CREATE, {
130
+ features: [state.line.toGeoJSON()]
131
+ });
132
+ } else {
133
+ this.deleteFeature([state.line.id], {
134
+ silent: true
135
+ });
136
+ this.changeMode(Constants.modes.SIMPLE_SELECT, {}, {
137
+ silent: true
138
+ });
139
+ }
140
+ };
141
+ DrawMarker.onTrash = function (state) {
142
+ this.deleteFeature([state.line.id], {
143
+ silent: true
144
+ });
145
+ this.changeMode(Constants.modes.SIMPLE_SELECT);
146
+ };
147
+ DrawMarker.toDisplayFeatures = function (state, geojson, display) {
148
+ const isActiveLine = geojson.properties.id === state.line.id;
149
+ geojson.properties.active = isActiveLine ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;
150
+ if (!isActiveLine) return display(geojson);
151
+ // Only render the line if it has at least one real coordinate
152
+ if (geojson.geometry.coordinates.length < 2) return;
153
+ geojson.properties.meta = Constants.meta.FEATURE;
154
+ display(createVertex(state.line.id, geojson.geometry.coordinates[state.direction === 'forward' ? geojson.geometry.coordinates.length - 2 : 1], "".concat(state.direction === 'forward' ? geojson.geometry.coordinates.length - 2 : 1), false));
155
+ display(geojson);
156
+ };
157
+ export default DrawMarker;
158
+ //# sourceMappingURL=draw_marker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draw_marker.js","names":["CommonSelectors","isEventAtCoordinates","doubleClickZoom","Constants","createVertex","DrawMarker","onSetup","opts","featureId","line","currentVertexPosition","direction","getFeature","Error","from","type","geometry","coordinates","length","Array","isArray","lastCoord","addCoordinate","newFeature","geojsonTypes","FEATURE","properties","marker","LINE_STRING","addFeature","clearSelectedFeatures","disable","updateUIClasses","mouse","cursors","ADD","activateUIButton","types","LINE","setActionableState","trash","clickAnywhere","state","e","changeMode","modes","SIMPLE_SELECT","featureIds","id","updateCoordinate","lngLat","lng","lat","clickOnVertex","onMouseMove","isVertex","POINTER","onTap","onClick","onKeyUp","isEnterKey","isEscapeKey","deleteFeature","silent","onStop","enable","undefined","removeCoordinate","concat","isValid","map","fire","events","CREATE","features","toGeoJSON","onTrash","toDisplayFeatures","geojson","display","isActiveLine","active","activeStates","ACTIVE","INACTIVE","meta"],"sources":["../../../../src/meta-atlas-sdk/mapbox_draw_custom_modes/draw_marker.js"],"sourcesContent":["import * as CommonSelectors from '@mapbox/mapbox-gl-draw/src/lib/common_selectors';\nimport isEventAtCoordinates from '@mapbox/mapbox-gl-draw/src/lib/is_event_at_coordinates';\nimport doubleClickZoom from '@mapbox/mapbox-gl-draw/src/lib/double_click_zoom';\nimport * as Constants from '@mapbox/mapbox-gl-draw/src/constants';\nimport createVertex from '@mapbox/mapbox-gl-draw/src/lib/create_vertex';\nconst DrawMarker = {};\n\nDrawMarker.onSetup = function(opts) {\n opts = opts || {};\n const featureId = opts.featureId;\n\n let line, currentVertexPosition;\n let direction = 'forward';\n if (featureId) {\n line = this.getFeature(featureId);\n if (!line) {\n throw new Error('Could not find a feature with the provided featureId');\n }\n let from = opts.from;\n if (from && from.type === 'Feature' && from.geometry && from.geometry.type === 'Point') {\n from = from.geometry;\n }\n if (from && from.type === 'Point' && from.coordinates && from.coordinates.length === 2) {\n from = from.coordinates;\n }\n if (!from || !Array.isArray(from)) {\n throw new Error('Please use the `from` property to indicate which point to continue the line from');\n }\n const lastCoord = line.coordinates.length - 1;\n if (line.coordinates[lastCoord][0] === from[0] && line.coordinates[lastCoord][1] === from[1]) {\n currentVertexPosition = lastCoord + 1;\n // add one new coordinate to continue from\n line.addCoordinate(currentVertexPosition, ...line.coordinates[lastCoord]);\n } else if (line.coordinates[0][0] === from[0] && line.coordinates[0][1] === from[1]) {\n direction = 'backwards';\n currentVertexPosition = 0;\n // add one new coordinate to continue from\n line.addCoordinate(currentVertexPosition, ...line.coordinates[0]);\n } else {\n throw new Error('`from` should match the point at either the start or the end of the provided LineString');\n }\n } else {\n line = this.newFeature({\n type: Constants.geojsonTypes.FEATURE,\n properties: {\n marker: true\n },\n geometry: {\n type: Constants.geojsonTypes.LINE_STRING,\n coordinates: []\n }\n });\n currentVertexPosition = 0;\n this.addFeature(line);\n }\n\n this.clearSelectedFeatures();\n doubleClickZoom.disable(this);\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n this.activateUIButton(Constants.types.LINE);\n this.setActionableState({\n trash: true\n });\n\n return {\n line,\n currentVertexPosition,\n direction\n };\n};\n\nDrawMarker.clickAnywhere = function(state, e) {\n if (state.currentVertexPosition > 0 && isEventAtCoordinates(e, state.line.coordinates[state.currentVertexPosition - 1]) ||\n state.direction === 'backwards' && isEventAtCoordinates(e, state.line.coordinates[state.currentVertexPosition + 1])) {\n return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.line.id] });\n }\n this.updateUIClasses({ mouse: Constants.cursors.ADD });\n state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);\n if (state.direction === 'forward') {\n state.currentVertexPosition++;\n state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);\n } else {\n state.line.addCoordinate(0, e.lngLat.lng, e.lngLat.lat);\n }\n\n state.line.addCoordinate(0, e.lngLat.lng+0.00001, e.lngLat.lat);\n return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.line.id] });\n};\n\nDrawMarker.clickOnVertex = function(state) {\n return this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.line.id] });\n};\n\nDrawMarker.onMouseMove = function(state, e) {\n state.line.updateCoordinate(state.currentVertexPosition, e.lngLat.lng, e.lngLat.lat);\n if (CommonSelectors.isVertex(e)) {\n this.updateUIClasses({ mouse: Constants.cursors.POINTER });\n }\n};\n\nDrawMarker.onTap = DrawMarker.onClick = function(state, e) {\n if (CommonSelectors.isVertex(e)) return this.clickOnVertex(state, e);\n this.clickAnywhere(state, e);\n};\n\nDrawMarker.onKeyUp = function(state, e) {\n if (CommonSelectors.isEnterKey(e)) {\n this.changeMode(Constants.modes.SIMPLE_SELECT, { featureIds: [state.line.id] });\n } else if (CommonSelectors.isEscapeKey(e)) {\n this.deleteFeature([state.line.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n }\n};\n\nDrawMarker.onStop = function(state) {\n doubleClickZoom.enable(this);\n this.activateUIButton();\n\n // check to see if we've deleted this feature\n if (this.getFeature(state.line.id) === undefined) return;\n\n //remove last added coordinate\n state.line.removeCoordinate(`${state.currentVertexPosition}`);\n if (state.line.isValid()) {\n this.map.fire(Constants.events.CREATE, {\n features: [state.line.toGeoJSON()]\n });\n } else {\n this.deleteFeature([state.line.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT, {}, { silent: true });\n }\n};\n\nDrawMarker.onTrash = function(state) {\n this.deleteFeature([state.line.id], { silent: true });\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nDrawMarker.toDisplayFeatures = function(state, geojson, display) {\n const isActiveLine = geojson.properties.id === state.line.id;\n geojson.properties.active = (isActiveLine) ? Constants.activeStates.ACTIVE : Constants.activeStates.INACTIVE;\n if (!isActiveLine) return display(geojson);\n // Only render the line if it has at least one real coordinate\n if (geojson.geometry.coordinates.length < 2) return;\n geojson.properties.meta = Constants.meta.FEATURE;\n display(createVertex(\n state.line.id,\n geojson.geometry.coordinates[state.direction === 'forward' ? geojson.geometry.coordinates.length - 2 : 1],\n `${state.direction === 'forward' ? geojson.geometry.coordinates.length - 2 : 1}`,\n false\n ));\n\n display(geojson);\n};\n\nexport default DrawMarker;"],"mappings":"AAAA,OAAO,KAAKA,eAAe,MAAM,iDAAiD;AAClF,OAAOC,oBAAoB,MAAM,wDAAwD;AACzF,OAAOC,eAAe,MAAM,kDAAkD;AAC9E,OAAO,KAAKC,SAAS,MAAM,sCAAsC;AACj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W,CAACC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,KAAAkD,MAAA,CACtG1B,KAAK,CAAC/B,SAAS,KAAK,SAAS,GAAGmE,OAAO,CAAC9D,QAAQ,CAACC,WAAW,CAACC,MAAM,GAAG,CAAC,GAAG,CAAC,GAC9E,KACF,CAAC,CAAC;EAEF6D,OAAO,CAACD,OAAO,CAAC;AAClB,CAAC;AAED,eAAezE,UAAU","ignoreList":[]}
@@ -0,0 +1,221 @@
1
+ import { noTarget, isOfMetaType, isActiveFeature, isInactiveFeature, isShiftDown } from '@mapbox/mapbox-gl-draw/src/lib/common_selectors';
2
+ import createSupplementaryPoints from '@mapbox/mapbox-gl-draw/src/lib/create_supplementary_points';
3
+ import constrainFeatureMovement from '@mapbox/mapbox-gl-draw/src/lib/constrain_feature_movement';
4
+ import doubleClickZoom from '@mapbox/mapbox-gl-draw/src/lib/double_click_zoom';
5
+ import * as Constants from '@mapbox/mapbox-gl-draw/src/constants';
6
+ import moveFeatures from '@mapbox/mapbox-gl-draw/src/lib/move_features';
7
+ const isVertex = isOfMetaType(Constants.meta.VERTEX);
8
+ const isMidpoint = isOfMetaType(Constants.meta.MIDPOINT);
9
+ const MarkerSelect = {};
10
+
11
+ // INTERNAL FUCNTIONS
12
+
13
+ MarkerSelect.fireUpdate = function () {
14
+ this.map.fire(Constants.events.UPDATE, {
15
+ action: Constants.updateActions.CHANGE_COORDINATES,
16
+ features: this.getSelected().map(f => f.toGeoJSON())
17
+ });
18
+ };
19
+ MarkerSelect.fireActionable = function (state) {
20
+ this.setActionableState({
21
+ combineFeatures: false,
22
+ uncombineFeatures: false,
23
+ trash: state.selectedCoordPaths.length > 0
24
+ });
25
+ };
26
+ MarkerSelect.startDragging = function (state, e) {
27
+ this.map.dragPan.disable();
28
+ state.canDragMove = true;
29
+ state.dragMoveLocation = e.lngLat;
30
+ };
31
+ MarkerSelect.stopDragging = function (state) {
32
+ this.map.dragPan.enable();
33
+ state.dragMoving = false;
34
+ state.canDragMove = false;
35
+ state.dragMoveLocation = null;
36
+ };
37
+ MarkerSelect.onVertex = function (state, e) {
38
+ this.startDragging(state, e);
39
+ const about = e.featureTarget.properties;
40
+ const selectedIndex = state.selectedCoordPaths.indexOf(about.coord_path);
41
+ if (!isShiftDown(e) && selectedIndex === -1) {
42
+ state.selectedCoordPaths = [about.coord_path];
43
+ } else if (isShiftDown(e) && selectedIndex === -1) {
44
+ state.selectedCoordPaths.push(about.coord_path);
45
+ }
46
+ const selectedCoordinates = this.pathsToCoordinates(state.featureId, state.selectedCoordPaths);
47
+ this.setSelectedCoordinates(selectedCoordinates);
48
+ };
49
+ MarkerSelect.onMidpoint = function (state, e) {
50
+ this.startDragging(state, e);
51
+ const about = e.featureTarget.properties;
52
+ state.feature.addCoordinate(about.coord_path, about.lng, about.lat);
53
+ this.fireUpdate();
54
+ state.selectedCoordPaths = [about.coord_path];
55
+ };
56
+ MarkerSelect.pathsToCoordinates = function (featureId, paths) {
57
+ return paths.map(coord_path => ({
58
+ feature_id: featureId,
59
+ coord_path
60
+ }));
61
+ };
62
+ MarkerSelect.onFeature = function (state, e) {
63
+ if (state.selectedCoordPaths.length === 0) this.startDragging(state, e);else this.stopDragging(state);
64
+ };
65
+ MarkerSelect.dragFeature = function (state, e, delta) {
66
+ moveFeatures(this.getSelected(), delta);
67
+ state.dragMoveLocation = e.lngLat;
68
+ };
69
+ MarkerSelect.dragVertex = function (state, e, delta) {
70
+ const selectedCoords = state.selectedCoordPaths.map(coord_path => state.feature.getCoordinate(coord_path));
71
+ const selectedCoordPoints = selectedCoords.map(coords => ({
72
+ type: Constants.geojsonTypes.FEATURE,
73
+ properties: {},
74
+ geometry: {
75
+ type: Constants.geojsonTypes.POINT,
76
+ coordinates: coords
77
+ }
78
+ }));
79
+ const constrainedDelta = constrainFeatureMovement(selectedCoordPoints, delta);
80
+ for (let i = 0; i < selectedCoords.length; i++) {
81
+ const coord = selectedCoords[i];
82
+ state.feature.updateCoordinate(state.selectedCoordPaths[i], coord[0] + constrainedDelta.lng, coord[1] + constrainedDelta.lat);
83
+ }
84
+ };
85
+ MarkerSelect.clickNoTarget = function () {
86
+ this.changeMode(Constants.modes.SIMPLE_SELECT);
87
+ };
88
+ MarkerSelect.clickInactive = function () {
89
+ this.changeMode(Constants.modes.SIMPLE_SELECT);
90
+ };
91
+ MarkerSelect.clickActiveFeature = function (state) {
92
+ state.selectedCoordPaths = [];
93
+ this.clearSelectedCoordinates();
94
+ state.feature.changed();
95
+ };
96
+
97
+ // EXTERNAL FUNCTIONS
98
+
99
+ MarkerSelect.onSetup = function (opts) {
100
+ const featureId = opts.featureId;
101
+ const feature = this.getFeature(featureId);
102
+ if (!feature) {
103
+ throw new Error('You must provide a featureId to enter direct_select mode');
104
+ }
105
+ if (feature.type === Constants.geojsonTypes.POINT) {
106
+ throw new TypeError('direct_select mode doesn\'t handle point features');
107
+ }
108
+ const state = {
109
+ featureId,
110
+ feature,
111
+ dragMoveLocation: opts.startPos || null,
112
+ dragMoving: false,
113
+ canDragMove: false,
114
+ selectedCoordPaths: opts.coordPath ? [opts.coordPath] : []
115
+ };
116
+ this.setSelectedCoordinates(this.pathsToCoordinates(featureId, state.selectedCoordPaths));
117
+ this.setSelected(featureId);
118
+ doubleClickZoom.disable(this);
119
+ this.setActionableState({
120
+ trash: true
121
+ });
122
+ return state;
123
+ };
124
+ MarkerSelect.onStop = function () {
125
+ doubleClickZoom.enable(this);
126
+ this.clearSelectedCoordinates();
127
+ };
128
+ MarkerSelect.toDisplayFeatures = function (state, geojson, push) {
129
+ if (state.featureId === geojson.properties.id) {
130
+ geojson.properties.active = Constants.activeStates.ACTIVE;
131
+ push(geojson);
132
+ createSupplementaryPoints(geojson, {
133
+ map: this.map,
134
+ midpoints: true,
135
+ selectedPaths: state.selectedCoordPaths
136
+ }).forEach(push);
137
+ } else {
138
+ geojson.properties.active = Constants.activeStates.INACTIVE;
139
+ push(geojson);
140
+ }
141
+ this.fireActionable(state);
142
+ };
143
+ MarkerSelect.onTrash = function (state) {
144
+ // Uses number-aware sorting to make sure '9' < '10'. Comparison is reversed because we want them
145
+ // in reverse order so that we can remove by index safely.
146
+ state.selectedCoordPaths.sort((a, b) => b.localeCompare(a, 'en', {
147
+ numeric: true
148
+ })).forEach(id => state.feature.removeCoordinate(id));
149
+ this.fireUpdate();
150
+ state.selectedCoordPaths = [];
151
+ this.clearSelectedCoordinates();
152
+ this.fireActionable(state);
153
+ if (state.feature.isValid() === false) {
154
+ this.deleteFeature([state.featureId]);
155
+ this.changeMode(Constants.modes.SIMPLE_SELECT, {});
156
+ }
157
+ };
158
+ MarkerSelect.onMouseMove = function (state, e) {
159
+ // On mousemove that is not a drag, stop vertex movement.
160
+ const isFeature = isActiveFeature(e);
161
+ const onVertex = isVertex(e);
162
+ const isMidPoint = isMidpoint(e);
163
+ const noCoords = state.selectedCoordPaths.length === 0;
164
+ if (isFeature && noCoords) this.updateUIClasses({
165
+ mouse: Constants.cursors.MOVE
166
+ });else if (onVertex && !noCoords) this.updateUIClasses({
167
+ mouse: Constants.cursors.MOVE
168
+ });else this.updateUIClasses({
169
+ mouse: Constants.cursors.NONE
170
+ });
171
+ const isDraggableItem = onVertex || isFeature || isMidPoint;
172
+ if (isDraggableItem && state.dragMoving) this.fireUpdate();
173
+ this.stopDragging(state);
174
+
175
+ // Skip render
176
+ return true;
177
+ };
178
+ MarkerSelect.onMouseOut = function (state) {
179
+ // As soon as you mouse leaves the canvas, update the feature
180
+ if (state.dragMoving) this.fireUpdate();
181
+
182
+ // Skip render
183
+ return true;
184
+ };
185
+ MarkerSelect.onTouchStart = MarkerSelect.onMouseDown = function (state, e) {
186
+ if (isVertex(e)) return this.onVertex(state, e);
187
+ if (isActiveFeature(e)) return this.onFeature(state, e);
188
+ if (isMidpoint(e)) return this.onMidpoint(state, e);
189
+ };
190
+ MarkerSelect.onDrag = function (state, e) {
191
+ if (state.canDragMove !== true) return;
192
+ state.dragMoving = true;
193
+ e.originalEvent.stopPropagation();
194
+ const delta = {
195
+ lng: e.lngLat.lng - state.dragMoveLocation.lng,
196
+ lat: e.lngLat.lat - state.dragMoveLocation.lat
197
+ };
198
+
199
+ // always drag feature, never drag vertex
200
+ this.dragFeature(state, e, delta);
201
+ state.dragMoveLocation = e.lngLat;
202
+ };
203
+ MarkerSelect.onClick = function (state, e) {
204
+ if (noTarget(e)) return this.clickNoTarget(state, e);
205
+ if (isActiveFeature(e)) return this.clickActiveFeature(state, e);
206
+ if (isInactiveFeature(e)) return this.clickInactive(state, e);
207
+ this.stopDragging(state);
208
+ };
209
+ MarkerSelect.onTap = function (state, e) {
210
+ if (noTarget(e)) return this.clickNoTarget(state, e);
211
+ if (isActiveFeature(e)) return this.clickActiveFeature(state, e);
212
+ if (isInactiveFeature(e)) return this.clickInactive(state, e);
213
+ };
214
+ MarkerSelect.onTouchEnd = MarkerSelect.onMouseUp = function (state) {
215
+ if (state.dragMoving) {
216
+ this.fireUpdate();
217
+ }
218
+ this.stopDragging(state);
219
+ };
220
+ export default MarkerSelect;
221
+ //# sourceMappingURL=marker_select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker_select.js","names":["noTarget","isOfMetaType","isActiveFeature","isInactiveFeature","isShiftDown","createSupplementaryPoints","constrainFeatureMovement","doubleClickZoom","Constants","moveFeatures","isVertex","meta","VERTEX","isMidpoint","MIDPOINT","MarkerSelect","fireUpdate","map","fire","events","UPDATE","action","updateActions","CHANGE_COORDINATES","features","getSelected","f","toGeoJSON","fireActionable","state","setActionableState","combineFeatures","uncombineFeatures","trash","selectedCoordPaths","length","startDragging","e","dragPan","disable","canDragMove","dragMoveLocation","lngLat","stopDragging","enable","dragMoving","onVertex","about","featureTarget","properties","selectedIndex","indexOf","coord_path","push","selectedCoordinates","pathsToCoordinates","featureId","setSelectedCoordinates","onMidpoint","feature","addCoordinate","lng","lat","paths","feature_id","onFeature","dragFeature","delta","dragVertex","selectedCoords","getCoordinate","selectedCoordPoints","coords","type","geojsonTypes","FEATURE","geometry","POINT","coordinates","constrainedDelta","i","coord","updateCoordinate","clickNoTarget","changeMode","modes","SIMPLE_SELECT","clickInactive","clickActiveFeature","clearSelectedCoordinates","changed","onSetup","opts","getFeature","Error","TypeError","startPos","coordPath","setSelected","onStop","toDisplayFeatures","geojson","id","active","activeStates","ACTIVE","midpoints","selectedPaths","forEach","INACTIVE","onTrash","sort","a","b","localeCompare","numeric","removeCoordinate","isValid","deleteFeature","onMouseMove","isFeature","isMidPoint","noCoords","updateUIClasses","mouse","cursors","MOVE","NONE","isDraggableItem","onMouseOut","onTouchStart","onMouseDown","onDrag","originalEvent","stopPropagation","onClick","onTap","onTouchEnd","onMouseUp"],"sources":["../../../../src/meta-atlas-sdk/mapbox_draw_custom_modes/marker_select.js"],"sourcesContent":["import {noTarget, isOfMetaType, isActiveFeature, isInactiveFeature, isShiftDown} from '@mapbox/mapbox-gl-draw/src/lib/common_selectors';\nimport createSupplementaryPoints from '@mapbox/mapbox-gl-draw/src/lib/create_supplementary_points';\nimport constrainFeatureMovement from '@mapbox/mapbox-gl-draw/src/lib/constrain_feature_movement';\nimport doubleClickZoom from '@mapbox/mapbox-gl-draw/src/lib/double_click_zoom';\nimport * as Constants from '@mapbox/mapbox-gl-draw/src/constants';\nimport moveFeatures from '@mapbox/mapbox-gl-draw/src/lib/move_features';\n\nconst isVertex = isOfMetaType(Constants.meta.VERTEX);\nconst isMidpoint = isOfMetaType(Constants.meta.MIDPOINT);\n\nconst MarkerSelect = {};\n\n// INTERNAL FUCNTIONS\n\nMarkerSelect.fireUpdate = function() {\n this.map.fire(Constants.events.UPDATE, {\n action: Constants.updateActions.CHANGE_COORDINATES,\n features: this.getSelected().map(f => f.toGeoJSON())\n });\n};\n\nMarkerSelect.fireActionable = function(state) {\n this.setActionableState({\n combineFeatures: false,\n uncombineFeatures: false,\n trash: state.selectedCoordPaths.length > 0\n });\n};\n\nMarkerSelect.startDragging = function(state, e) {\n this.map.dragPan.disable();\n state.canDragMove = true;\n state.dragMoveLocation = e.lngLat;\n};\n\nMarkerSelect.stopDragging = function(state) {\n this.map.dragPan.enable();\n state.dragMoving = false;\n state.canDragMove = false;\n state.dragMoveLocation = null;\n};\n\nMarkerSelect.onVertex = function (state, e) {\n this.startDragging(state, e);\n const about = e.featureTarget.properties;\n const selectedIndex = state.selectedCoordPaths.indexOf(about.coord_path);\n if (!isShiftDown(e) && selectedIndex === -1) {\n state.selectedCoordPaths = [about.coord_path];\n } else if (isShiftDown(e) && selectedIndex === -1) {\n state.selectedCoordPaths.push(about.coord_path);\n }\n\n const selectedCoordinates = this.pathsToCoordinates(state.featureId, state.selectedCoordPaths);\n this.setSelectedCoordinates(selectedCoordinates);\n};\n\nMarkerSelect.onMidpoint = function(state, e) {\n this.startDragging(state, e);\n const about = e.featureTarget.properties;\n state.feature.addCoordinate(about.coord_path, about.lng, about.lat);\n this.fireUpdate();\n state.selectedCoordPaths = [about.coord_path];\n};\n\nMarkerSelect.pathsToCoordinates = function(featureId, paths) {\n return paths.map(coord_path => ({ feature_id: featureId, coord_path }));\n};\n\nMarkerSelect.onFeature = function(state, e) {\n if (state.selectedCoordPaths.length === 0) this.startDragging(state, e);\n else this.stopDragging(state);\n};\n\nMarkerSelect.dragFeature = function(state, e, delta) {\n moveFeatures(this.getSelected(), delta);\n state.dragMoveLocation = e.lngLat;\n};\n\nMarkerSelect.dragVertex = function(state, e, delta) {\n const selectedCoords = state.selectedCoordPaths.map(coord_path => state.feature.getCoordinate(coord_path));\n const selectedCoordPoints = selectedCoords.map(coords => ({\n type: Constants.geojsonTypes.FEATURE,\n properties: {},\n geometry: {\n type: Constants.geojsonTypes.POINT,\n coordinates: coords\n }\n }));\n\n const constrainedDelta = constrainFeatureMovement(selectedCoordPoints, delta);\n for (let i = 0; i < selectedCoords.length; i++) {\n const coord = selectedCoords[i];\n state.feature.updateCoordinate(state.selectedCoordPaths[i], coord[0] + constrainedDelta.lng, coord[1] + constrainedDelta.lat);\n }\n};\n\nMarkerSelect.clickNoTarget = function () {\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nMarkerSelect.clickInactive = function () {\n this.changeMode(Constants.modes.SIMPLE_SELECT);\n};\n\nMarkerSelect.clickActiveFeature = function (state) {\n state.selectedCoordPaths = [];\n this.clearSelectedCoordinates();\n state.feature.changed();\n};\n\n// EXTERNAL FUNCTIONS\n\nMarkerSelect.onSetup = function(opts) {\n const featureId = opts.featureId;\n const feature = this.getFeature(featureId);\n\n if (!feature) {\n throw new Error('You must provide a featureId to enter direct_select mode');\n }\n\n if (feature.type === Constants.geojsonTypes.POINT) {\n throw new TypeError('direct_select mode doesn\\'t handle point features');\n }\n\n const state = {\n featureId,\n feature,\n dragMoveLocation: opts.startPos || null,\n dragMoving: false,\n canDragMove: false,\n selectedCoordPaths: opts.coordPath ? [opts.coordPath] : []\n };\n\n this.setSelectedCoordinates(this.pathsToCoordinates(featureId, state.selectedCoordPaths));\n this.setSelected(featureId);\n doubleClickZoom.disable(this);\n\n this.setActionableState({\n trash: true\n });\n\n return state;\n};\n\nMarkerSelect.onStop = function() {\n doubleClickZoom.enable(this);\n this.clearSelectedCoordinates();\n};\n\nMarkerSelect.toDisplayFeatures = function(state, geojson, push) {\n if (state.featureId === geojson.properties.id) {\n geojson.properties.active = Constants.activeStates.ACTIVE;\n push(geojson);\n createSupplementaryPoints(geojson, {\n map: this.map,\n midpoints: true,\n selectedPaths: state.selectedCoordPaths\n }).forEach(push);\n } else {\n geojson.properties.active = Constants.activeStates.INACTIVE;\n push(geojson);\n }\n this.fireActionable(state);\n};\n\nMarkerSelect.onTrash = function(state) {\n // Uses number-aware sorting to make sure '9' < '10'. Comparison is reversed because we want them\n // in reverse order so that we can remove by index safely.\n state.selectedCoordPaths\n .sort((a, b) => b.localeCompare(a, 'en', { numeric: true }))\n .forEach(id => state.feature.removeCoordinate(id));\n this.fireUpdate();\n state.selectedCoordPaths = [];\n this.clearSelectedCoordinates();\n this.fireActionable(state);\n if (state.feature.isValid() === false) {\n this.deleteFeature([state.featureId]);\n this.changeMode(Constants.modes.SIMPLE_SELECT, {});\n }\n};\n\nMarkerSelect.onMouseMove = function(state, e) {\n // On mousemove that is not a drag, stop vertex movement.\n const isFeature = isActiveFeature(e);\n const onVertex = isVertex(e);\n const isMidPoint = isMidpoint(e);\n const noCoords = state.selectedCoordPaths.length === 0;\n if (isFeature && noCoords) this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n else if (onVertex && !noCoords) this.updateUIClasses({ mouse: Constants.cursors.MOVE });\n else this.updateUIClasses({ mouse: Constants.cursors.NONE });\n\n const isDraggableItem = onVertex || isFeature || isMidPoint;\n if (isDraggableItem && state.dragMoving) this.fireUpdate();\n\n this.stopDragging(state);\n\n // Skip render\n return true;\n};\n\nMarkerSelect.onMouseOut = function(state) {\n // As soon as you mouse leaves the canvas, update the feature\n if (state.dragMoving) this.fireUpdate();\n\n // Skip render\n return true;\n};\n\nMarkerSelect.onTouchStart = MarkerSelect.onMouseDown = function(state, e) {\n if (isVertex(e)) return this.onVertex(state, e);\n if (isActiveFeature(e)) return this.onFeature(state, e);\n if (isMidpoint(e)) return this.onMidpoint(state, e);\n};\n\nMarkerSelect.onDrag = function(state, e) {\n if (state.canDragMove !== true) return;\n state.dragMoving = true;\n e.originalEvent.stopPropagation();\n\n const delta = {\n lng: e.lngLat.lng - state.dragMoveLocation.lng,\n lat: e.lngLat.lat - state.dragMoveLocation.lat\n };\n \n // always drag feature, never drag vertex\n this.dragFeature(state, e, delta);\n\n state.dragMoveLocation = e.lngLat;\n};\n\nMarkerSelect.onClick = function(state, e) {\n if (noTarget(e)) return this.clickNoTarget(state, e);\n if (isActiveFeature(e)) return this.clickActiveFeature(state, e);\n if (isInactiveFeature(e)) return this.clickInactive(state, e);\n this.stopDragging(state);\n};\n\nMarkerSelect.onTap = function(state, e) {\n if (noTarget(e)) return this.clickNoTarget(state, e);\n if (isActiveFeature(e)) return this.clickActiveFeature(state, e);\n if (isInactiveFeature(e)) return this.clickInactive(state, e);\n};\n\nMarkerSelect.onTouchEnd = MarkerSelect.onMouseUp = function(state) {\n if (state.dragMoving) {\n this.fireUpdate();\n }\n this.stopDragging(state);\n};\n\nexport default MarkerSelect;\n"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,YAAY,EAAEC,eAAe,EAAEC,iBAAiB,EAAEC,WAAW,QAAO,iDAAiD;AACvI,OAAOC,yBAAyB,MAAM,4DAA4D;AAClG,OAAOC,wBAAwB,MAAM,2DAA2D;AAChG,OAAOC,eAAe,MAAM,kDAAkD;AAC9E,OAAO,KAAKC,SAAS,MAAM,sCAAsC;AACjE,OAAOC,YAAY,MAAM,8CAA8C;AAEvE,MAAMC,QAAQ,GAAGT,YAAY,CAACO,SAAS,CAACG,IAAI,CAACC,MAAM,CAAC;AACpD,MAAMC,UAAU,GAAGZ,YAAY,CAACO,SAAS,CAACG,IAAI,CAACG,QAAQ,CAAC;AAExD,MAAMC,YAAY,GAAG,CAAC,CAAC;;AAEvB;;AAEAA,YAAY,CAACC,UAAU,GAAG,YAAW;EACnC,IAAI,CAACC,GAAG,CAACC,IAAI,CAACV,SAAS,CAACW,MAAM,CAACC,MAAM,EAAE;IACrCC,MAAM,EAAEb,SAAS,CAACc,aAAa,CAACC,kBAAkB;IAClDC,QAAQ,EAAE,IAAI,CAACC,WAAW,CAAC,CAAC,CAACR,GAAG,CAACS,CAAC,IAAIA,CAAC,CAACC,SAAS,CAAC,CAAC;EACrD,CAAC,CAAC;AACJ,CAAC;AAEDZ,YAAY,CAACa,cAAc,GAAG,UAASC,KAAK,EAAE;EAC5C,IAAI,CAACC,kBAAkB,CAAC;IACtBC,eAAe,EAAE,KAAK;IACtBC,iBAAiB,EAAE,KAAK;IACxBC,KAAK,EAAEJ,KAAK,CAACK,kBAAkB,CAACC,MAAM,GAAG;EAC3C,CAAC,CAAC;AACJ,CAAC;AAEDpB,YAAY,CAACqB,aAAa,GAAG,UAASP,KAAK,EAAEQ,CAAC,EAAE;EAC9C,IAAI,CAACpB,GAAG,CAACqB,OAAO,CAACC,OAAO,CAA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CAAC;AAC1B,CAAC;AAEDd,YAAY,CAACyH,KAAK,GAAG,UAAS3G,KAAK,EAAEQ,CAAC,EAAE;EACtC,IAAIrC,QAAQ,CAACqC,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC8C,aAAa,CAACtD,KAAK,EAAEQ,CAAC,CAAC;EACpD,IAAInC,eAAe,CAACmC,CAAC,CAAC,EAAE,OAAO,IAAI,CAACmD,kBAAkB,CAAC3D,KAAK,EAAEQ,CAAC,CAAC;EAChE,IAAIlC,iBAAiB,CAACkC,CAAC,CAAC,EAAE,OAAO,IAAI,CAACkD,aAAa,CAAC1D,KAAK,EAAEQ,CAAC,CAAC;AAC/D,CAAC;AAEDtB,YAAY,CAAC0H,UAAU,GAAG1H,YAAY,CAAC2H,SAAS,GAAG,UAAS7G,KAAK,EAAE;EACjE,IAAIA,KAAK,CAACgB,UAAU,EAAE;IACpB,IAAI,CAAC7B,UAAU,CAAC,CAAC;EACnB;EACA,IAAI,CAAC2B,YAAY,CAACd,KAAK,CAAC;AAC1B,CAAC;AAED,eAAed,YAAY","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twinmatrix/spatialverse-sdk-web",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Spatialverse SDK for Web",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -27,8 +27,8 @@
27
27
  "scripts": {
28
28
  "clean": "rimraf lib",
29
29
  "declarations": "tsc -p tsconfig.json",
30
- "build:esm": "cross-env BABEL_ENV=esmUnbundled babel src --extensions '.ts,.tsx' --out-dir 'lib/esm' --source-maps",
31
- "build:cjs": "cross-env BABEL_ENV=cjs babel src --extensions '.ts,.tsx' --out-dir 'lib/cjs' --source-maps",
30
+ "build:esm": "cross-env BABEL_ENV=esmUnbundled babel src --extensions '.ts,.tsx,.js' --out-dir 'lib/esm' --source-maps && node copy-json-files.js && node fix-json-imports.js",
31
+ "build:cjs": "cross-env BABEL_ENV=cjs babel src --extensions '.ts,.tsx,.js' --out-dir 'lib/cjs' --source-maps && node copy-json-files.js && node fix-json-imports.js",
32
32
  "build:bundles": "cross-env BABEL_ENV=esmBundled rollup -c",
33
33
  "build": "npm-run-all -l clean -p build:esm build:cjs declarations",
34
34
  "test": "jest"