From fa611ff2eeaac289931eb0e21a962743fb271ba7 Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Fri, 23 Sep 2022 17:46:57 +0800
Subject: [PATCH] Update v1.2.0
---
src/hooks/use-mouse-tool.ts | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/hooks/use-mouse-tool.ts b/src/hooks/use-mouse-tool.ts
index 2a5aa84..2794b7f 100644
--- a/src/hooks/use-mouse-tool.ts
+++ b/src/hooks/use-mouse-tool.ts
@@ -6,13 +6,14 @@
export function useMouseTool () {
const root = getRoot()
- const AMap = root.$aMapObj
+
const state = reactive({
pinNum: 0,
polylineNum: 0,
PolygonNum: 0,
currentType: '',
})
+
function drawPin (type:MapDoodleType, getDrawCallback:Function) {
root?.$mouseTool.marker({
title: type + state.pinNum,
@@ -21,6 +22,7 @@
state.pinNum++
root?.$mouseTool.on('draw', getDrawCallback)
}
+
function drawPolyline (type:MapDoodleType, getDrawCallback:Function) {
root?.$mouseTool.polyline({
strokeColor: '#2d8cf0',
@@ -32,6 +34,7 @@
})
root?.$mouseTool.on('draw', getDrawCallback)
}
+
function drawPolygon (type:MapDoodleType, getDrawCallback:Function) {
root?.$mouseTool.polygon({
strokeColor: '#2d8cf0',
@@ -44,10 +47,12 @@
})
root?.$mouseTool.on('draw', getDrawCallback)
}
+
function drawOff (type:MapDoodleType) {
root?.$mouseTool.close()
root?.$mouseTool.off('draw')
}
+
function mouseTool (type: MapDoodleType, getDrawCallback: Function) {
state.currentType = type
switch (type) {
@@ -65,6 +70,7 @@
break
}
}
+
return {
mouseTool
}
--
Gitblit v1.9.3