|
@@ -6,13 +6,14 @@ import MapUtil from "../utils/MapUtil";
|
|
|
import App from "../App";
|
|
|
|
|
|
export default class LocationCard{
|
|
|
+ delta_time;
|
|
|
/** * 定位卡
|
|
|
* @param {Number} x - 定位卡x坐标
|
|
|
* @param {Number} y - 定位卡y坐标
|
|
|
* @param {String} milli_time - 定位时间戳(毫秒)
|
|
|
* @param {String} loc_time - 定位时间
|
|
|
* @param {Number} card_id - 定位卡ID
|
|
|
- * @param {JSX} info - jsx详细信息
|
|
|
+ * @param {String} info - 详细信息 (html格式字符串)
|
|
|
* @param {String} src - 标记图标路径
|
|
|
*/
|
|
|
constructor(x, y, loc_time, milli_time, card_id, info, src){
|
|
@@ -30,10 +31,21 @@ export default class LocationCard{
|
|
|
PubSub.publish('map.card.add', this);
|
|
|
}
|
|
|
|
|
|
- move(x, y){
|
|
|
+ move(x, y, duration = 1000){
|
|
|
let latlng = MapUtil.distancePointToLatLng(App.origin, x, y);
|
|
|
this.lat = latlng.lat;
|
|
|
this.lng = latlng.lng;
|
|
|
+ this.delta_time = duration;
|
|
|
+ PubSub.publish('map.card.move', this);
|
|
|
+ }
|
|
|
+
|
|
|
+ update(x, y, milli_time, loc_time){
|
|
|
+ let latlng = MapUtil.distancePointToLatLng(App.origin, x, y);
|
|
|
+ this.lat = latlng.lat;
|
|
|
+ this.lng = latlng.lng;
|
|
|
+ this.delta_time = milli_time - this.milli_time;
|
|
|
+ this.milli_time = milli_time;
|
|
|
+ this.loc_time = loc_time;
|
|
|
PubSub.publish('map.card.move', this);
|
|
|
}
|
|
|
|