Skip to content

Commit d801b2e

Browse files
committed
update
1 parent 21dacd2 commit d801b2e

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

geojson-editor/src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function handleMapLoaded(map: maplibregl.Map) {
3737
tiles: ["https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"]
3838
}
3939
});
40-
map.doubleClickZoom.disable();
40+
4141
// 中键旋转
4242
new MiddleButtonRoate(map);
4343

packages/maplugin-core/managers/geojson-draw-manager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class DrawManager {
148148
start(mode: TDrawGeometryType) {
149149
this.stop();
150150
this._drawing = true;
151-
(this.glManager.map as any).doubleClickZoom.disable();
151+
this.glManager.map.doubleClickZoom.disable();
152152

153153
if (mode === 'Point')
154154
this.stopFunc = this.drawPoint();
@@ -163,8 +163,8 @@ export class DrawManager {
163163
}
164164

165165
stop() {
166-
if ((this.glManager.map as any).doubleClickZoom.isEnabled) {
167-
(this.glManager.map as any).doubleClickZoom.enable();
166+
if (this.glManager.map.doubleClickZoom.isEnabled()) {
167+
this.glManager.map.doubleClickZoom.enable();
168168
}
169169

170170
if (this.currentFeatureId) {

packages/maplugin-core/types.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ export interface IMap {
3131
setPaintProperty(layerId: string, property: string, value: any): void,
3232
setLayoutProperty(layerId: string, property: string, value: any): void,
3333

34-
setFilter(id: string, filter?: any, options?: any): void
34+
setFilter(id: string, filter?: any, options?: any): void,
35+
36+
doubleClickZoom : {
37+
enable(): void;
38+
disable(): void;
39+
isEnabled(): boolean;
40+
isActive(): boolean;
41+
}
3542
}
3643

3744
export type TIdentityGeoJSONFeature = GeoJSON.Feature<GeoJSON.Geometry, { id: string }>;

packages/maplugin-core/utils/vertex-editor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export class VertexEditor {
88
*
99
*/
1010
constructor(private map: IMap) {
11+
map.doubleClickZoom.disable();
1112
// 创建编辑器
1213
this.editor = new MapboxDraw({
1314
controls: {
@@ -16,12 +17,14 @@ export class VertexEditor {
1617
displayControlsDefault: false
1718
});
1819
this.editor.onAdd(map as any);
20+
1921
// 禁止图形平移
2022
const onDrag = MapboxDraw.modes.direct_select.onDrag;
2123
MapboxDraw.modes.direct_select.onDrag = function (this, state, e) {
2224
if (state.selectedCoordPaths.length > 0)
2325
onDrag?.call(this, state, e);
2426
};
27+
2528
// 禁止删除图形
2629
const directSelectOnTrash = MapboxDraw.modes.direct_select.onTrash;
2730
MapboxDraw.modes.direct_select.onTrash = function (this, state) {

0 commit comments

Comments
 (0)