From 820c6a9e6e0e50f7266b8ccaf9c802a1005bda51 Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Tue, 11 Jun 2019 17:42:39 +0800
Subject: [PATCH] sensor
---
src/main/webapp/js/moralmap.js | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js
index 5017183..35bb72c 100644
--- a/src/main/webapp/js/moralmap.js
+++ b/src/main/webapp/js/moralmap.js
@@ -956,17 +956,23 @@
}
moralMap.callJS = function(condition) {
- var condition = JSON.parse(condition);
- var new_point = new BMap.Point(condition.longitude, condition.latitude);
- baiduMap.panTo(new_point);
- baiduMap.setCenter(new_point);
- if (condition.type == "mpoint") {
- baiduMap.setZoom(17);
- moralMap.openInfoWindow(moralMap.getMpoint(condition.id)["infoWindow"], new_point);
- } else if (condition.type == "device") {
- baiduMap.setZoom(18);
- moralMap.openInfoWindow(moralMap.getEquipment(condition.mac)["infoWindow"], new_point);
- }
+ var new_point = new BMap.Point(condition.longitude, condition.latitude);
+ baiduMap.panTo(new_point);
+ baiduMap.setCenter(new_point);
+ baiduMap.setZoom(condition.type == "mpoint" ? 17 : 18);
+ var interval = setInterval(function(){
+ var marker;
+ if (condition.type == "mpoint") {
+ marker = moralMap.getMpoint(condition.id);
+ } else if (condition.type == "device") {
+ marker = moralMap.getEquipment(condition.mac);
+ }
+ if(marker){
+ clearInterval(interval);
+ moralMap.openInfoWindow(marker["infoWindow"], new_point);
+ }
+ }, 50);
+
}
--
Gitblit v1.8.0