From 8adf3b2e4bfe72d8549bc748911cb92bc2b57b4c Mon Sep 17 00:00:00 2001 From: shy Date: Thu, 12 Oct 2023 17:25:06 +0800 Subject: [PATCH] add some --- lib/user.js | 2 +- plugin/local/chat/location.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/user.js b/lib/user.js index 40e8b26a..de91529b 100644 --- a/lib/user.js +++ b/lib/user.js @@ -4,7 +4,7 @@ Volcanos("user", { scanQRCode: function(can, cb) { can.user.input(event, can, [{type: html.TEXTAREA, name: mdb.TEXT, text: ""}], function(list) { cb(can.base.ParseJSON(list[0])) }) }, getLocation: function(can, cb) { var call = arguments.callee; if (call._res) { return cb(call._res) } navigator.geolocation.getCurrentPosition(function(res) { - cb(call._res = {type: "ip", name: "当前位置", text: "某某大街", latitude: res.coords.latitude, longitude: res.coords.longitude}) + cb(call._res = {type: "ip", name: "当前位置", text: "某某大街", latitude: res.coords.latitude.toFixed(6), longitude: res.coords.longitude.toFixed(6)}) }, function(some) { can.base.isFunc(cb) && cb({type: "location", name: "北京市", text: "天安门", latitude: 39.98412, longitude: 116.30748}) } ) }, openLocation: function(can, msg) { diff --git a/plugin/local/chat/location.js b/plugin/local/chat/location.js index 3bc7904e..6db07879 100644 --- a/plugin/local/chat/location.js +++ b/plugin/local/chat/location.js @@ -184,7 +184,7 @@ Volcanos(chat.ONACTION, {list: [["mode", mdb.SELECT, mdb.INSERT], pitch: function(event, can) { can.map.setPitch(can.Action("pitch")) }, rotation: function(event, can) { can.map.setRotation(can.Action("rotation")) }, _point: function(event, can, item) { var rect = can.ui.content.getBoundingClientRect() - return can.base.Copy({left: rect.left+event.point.x, bottom: rect.top+event.point.y, latitude: event.latLng.lat, longitude: event.latLng.lng}, item, true) + return can.base.Copy({left: rect.left+event.point.x, bottom: rect.top+event.point.y, latitude: event.latLng.lat.toFixed(6), longitude: event.latLng.lng.toFixed(6)}, item, true) }, center: function(can, item) { var point = can.onimport.point(can, item); can.map.setCenter(point); if (!item.name) { return } can.current.item = item, can.Status(mdb.NAME, ""), can.Status(mdb.TEXT, ""), can.Status(item), can.Status({latitude: point.lat, longitude: point.lng})