map-ol-utils 0.0.75 → 0.1.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/dist/index.cjs +9 -6
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +9 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -168,8 +168,8 @@ var resetActiveVector = () => {
|
|
|
168
168
|
interaction == null ? void 0 : interaction.getFeatures().clear();
|
|
169
169
|
});
|
|
170
170
|
};
|
|
171
|
-
var setFitViewByCoords = (coords, fitOptions) => {
|
|
172
|
-
const view =
|
|
171
|
+
var setFitViewByCoords = (coords, mapInstance = instance, fitOptions) => {
|
|
172
|
+
const view = mapInstance.getView();
|
|
173
173
|
if (coords.length === 1) {
|
|
174
174
|
view.animate(__spreadValues({
|
|
175
175
|
zoom: 14,
|
|
@@ -184,16 +184,16 @@ var setFitViewByCoords = (coords, fitOptions) => {
|
|
|
184
184
|
}, fitOptions || {}));
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
var setFitViewByGeom = (geom, fitOptions) => {
|
|
188
|
-
|
|
187
|
+
var setFitViewByGeom = (geom, mapInstance = instance, fitOptions) => {
|
|
188
|
+
mapInstance.getView().fit(geom, __spreadValues({
|
|
189
189
|
padding: [50, 50, 50, 50],
|
|
190
190
|
duration: 1e3
|
|
191
191
|
}, fitOptions || {}));
|
|
192
192
|
};
|
|
193
|
-
var setFitViewByLayer = (layer, fitOptions) => {
|
|
193
|
+
var setFitViewByLayer = (layer, mapInstance = instance, fitOptions) => {
|
|
194
194
|
var _a;
|
|
195
195
|
const extent = ((_a = layer.getSource()) == null ? void 0 : _a.getExtent()) || [];
|
|
196
|
-
|
|
196
|
+
mapInstance.getView().fit(extent, __spreadValues({
|
|
197
197
|
padding: [50, 50, 50, 50],
|
|
198
198
|
duration: 1e3
|
|
199
199
|
}, fitOptions || {}));
|
|
@@ -822,6 +822,9 @@ var createMap = (config = {}) => {
|
|
|
822
822
|
return instance2;
|
|
823
823
|
};
|
|
824
824
|
var disposeMap = (mapInstance = instance) => {
|
|
825
|
+
mapInstance.getOverlays().forEach((overlay) => {
|
|
826
|
+
mapInstance.removeOverlay(overlay);
|
|
827
|
+
});
|
|
825
828
|
const layers = mapInstance.getAllLayers();
|
|
826
829
|
layers.forEach((layer) => {
|
|
827
830
|
mapInstance.removeLayer(layer);
|
package/dist/index.d.cts
CHANGED
|
@@ -134,21 +134,24 @@ declare const resetActiveVector: () => void;
|
|
|
134
134
|
/**
|
|
135
135
|
* 根据Array<Coordinate> Fit
|
|
136
136
|
* @param coords
|
|
137
|
+
* @param mapInstance
|
|
137
138
|
* @param fitOptions
|
|
138
139
|
*/
|
|
139
|
-
declare const setFitViewByCoords: (coords: Array<Coordinate>, fitOptions?: FitOptions | AnimationOptions) => void;
|
|
140
|
+
declare const setFitViewByCoords: (coords: Array<Coordinate>, mapInstance?: CustomMap, fitOptions?: FitOptions | AnimationOptions) => void;
|
|
140
141
|
/**
|
|
141
142
|
* 根据SimpleGeometry Fit
|
|
142
143
|
* @param geom
|
|
144
|
+
* @param mapInstance
|
|
143
145
|
* @param fitOptions
|
|
144
146
|
*/
|
|
145
|
-
declare const setFitViewByGeom: (geom: SimpleGeometry, fitOptions?: FitOptions) => void;
|
|
147
|
+
declare const setFitViewByGeom: (geom: SimpleGeometry, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
146
148
|
/**
|
|
147
149
|
* 根据VectorLayer要素的四至信息Fit
|
|
148
150
|
* @param layer
|
|
151
|
+
* @param mapInstance
|
|
149
152
|
* @param fitOptions
|
|
150
153
|
*/
|
|
151
|
-
declare const setFitViewByLayer: (layer: VectorLayer, fitOptions?: FitOptions) => void;
|
|
154
|
+
declare const setFitViewByLayer: (layer: VectorLayer, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
152
155
|
declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<ol_geom.Geometry>>, Feature<ol_geom.Geometry>>;
|
|
153
156
|
/**
|
|
154
157
|
* 追加Features
|
package/dist/index.d.ts
CHANGED
|
@@ -134,21 +134,24 @@ declare const resetActiveVector: () => void;
|
|
|
134
134
|
/**
|
|
135
135
|
* 根据Array<Coordinate> Fit
|
|
136
136
|
* @param coords
|
|
137
|
+
* @param mapInstance
|
|
137
138
|
* @param fitOptions
|
|
138
139
|
*/
|
|
139
|
-
declare const setFitViewByCoords: (coords: Array<Coordinate>, fitOptions?: FitOptions | AnimationOptions) => void;
|
|
140
|
+
declare const setFitViewByCoords: (coords: Array<Coordinate>, mapInstance?: CustomMap, fitOptions?: FitOptions | AnimationOptions) => void;
|
|
140
141
|
/**
|
|
141
142
|
* 根据SimpleGeometry Fit
|
|
142
143
|
* @param geom
|
|
144
|
+
* @param mapInstance
|
|
143
145
|
* @param fitOptions
|
|
144
146
|
*/
|
|
145
|
-
declare const setFitViewByGeom: (geom: SimpleGeometry, fitOptions?: FitOptions) => void;
|
|
147
|
+
declare const setFitViewByGeom: (geom: SimpleGeometry, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
146
148
|
/**
|
|
147
149
|
* 根据VectorLayer要素的四至信息Fit
|
|
148
150
|
* @param layer
|
|
151
|
+
* @param mapInstance
|
|
149
152
|
* @param fitOptions
|
|
150
153
|
*/
|
|
151
|
-
declare const setFitViewByLayer: (layer: VectorLayer, fitOptions?: FitOptions) => void;
|
|
154
|
+
declare const setFitViewByLayer: (layer: VectorLayer, mapInstance?: CustomMap, fitOptions?: FitOptions) => void;
|
|
152
155
|
declare const createBusinessLayer: (dataList: MassData[], config: VectorConfig) => VectorLayer<VectorSource<Feature<ol_geom.Geometry>>, Feature<ol_geom.Geometry>>;
|
|
153
156
|
/**
|
|
154
157
|
* 追加Features
|
package/dist/index.js
CHANGED
|
@@ -104,8 +104,8 @@ var resetActiveVector = () => {
|
|
|
104
104
|
interaction == null ? void 0 : interaction.getFeatures().clear();
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
|
-
var setFitViewByCoords = (coords, fitOptions) => {
|
|
108
|
-
const view =
|
|
107
|
+
var setFitViewByCoords = (coords, mapInstance = instance, fitOptions) => {
|
|
108
|
+
const view = mapInstance.getView();
|
|
109
109
|
if (coords.length === 1) {
|
|
110
110
|
view.animate(__spreadValues({
|
|
111
111
|
zoom: 14,
|
|
@@ -120,16 +120,16 @@ var setFitViewByCoords = (coords, fitOptions) => {
|
|
|
120
120
|
}, fitOptions || {}));
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
var setFitViewByGeom = (geom, fitOptions) => {
|
|
124
|
-
|
|
123
|
+
var setFitViewByGeom = (geom, mapInstance = instance, fitOptions) => {
|
|
124
|
+
mapInstance.getView().fit(geom, __spreadValues({
|
|
125
125
|
padding: [50, 50, 50, 50],
|
|
126
126
|
duration: 1e3
|
|
127
127
|
}, fitOptions || {}));
|
|
128
128
|
};
|
|
129
|
-
var setFitViewByLayer = (layer, fitOptions) => {
|
|
129
|
+
var setFitViewByLayer = (layer, mapInstance = instance, fitOptions) => {
|
|
130
130
|
var _a;
|
|
131
131
|
const extent = ((_a = layer.getSource()) == null ? void 0 : _a.getExtent()) || [];
|
|
132
|
-
|
|
132
|
+
mapInstance.getView().fit(extent, __spreadValues({
|
|
133
133
|
padding: [50, 50, 50, 50],
|
|
134
134
|
duration: 1e3
|
|
135
135
|
}, fitOptions || {}));
|
|
@@ -758,6 +758,9 @@ var createMap = (config = {}) => {
|
|
|
758
758
|
return instance2;
|
|
759
759
|
};
|
|
760
760
|
var disposeMap = (mapInstance = instance) => {
|
|
761
|
+
mapInstance.getOverlays().forEach((overlay) => {
|
|
762
|
+
mapInstance.removeOverlay(overlay);
|
|
763
|
+
});
|
|
761
764
|
const layers = mapInstance.getAllLayers();
|
|
762
765
|
layers.forEach((layer) => {
|
|
763
766
|
mapInstance.removeLayer(layer);
|