calculateDrivingDirection(newCoordinates,oldCoordinates){
let o = {
direction: '',
deviation:null,
isTop: false,
isRight: false,
newLng: newCoordinates[0],
newLat: newCoordinates[1],
oldLng: oldCoordinates[0],
oldLat: oldCoordinates[1],
}
o.deviation = Math.abs((o.newLng - o.oldLng)) - Math.abs((o.newLat - o.oldLat))
o.newLng - o.oldLng > 0 ? o.isRight = true : o.isRight = false
o.newLat - o.oldLat > 0 ? o.isTop = true : o.isTop = false
if(o.deviation > 0){ // 大于零 水平方向移动
o.isRight ? o.direction = 'right' : o.direction = 'left'
}else{ // 小于零 垂直方向移动
o.isTop ? o.direction = 'top' : o.direction = 'down'
} return o.direction
},

  

    .car-loc-marker.right{
transform: rotate(0deg)
}
.car-loc-marker.left{
transform: rotate(180deg)
}
.car-loc-marker.top{
transform: rotate(-90deg)
}
.car-loc-marker.down{
transform: rotate(90deg)
}
 
 
 
API 
marker.moveTo()
 
 
 
 
 
 
 
 

个人相关API - 行驶方向判断函数的更多相关文章

  1. FreeRTOS-05任务相关API函数

    根据正点原子FreeRTOS视频整理 单片机:STM32F207VC FreeRTOS源码版本:v10.0.1 任务相关API函数: 1. main.c /* * */ #include " ...

  2. 历史相关API

    一.history对象 ①history.back()移动到上一个访问页面,等同于浏览器的后退键. ②history.forward()动到下一个访问页面,等同于浏览器的前进键. ③history.g ...

  3. Zookeeper C API 指南三(回调函数)(转)

    2013-02-21 12:54 by Haippy, 9237 阅读, 0 评论, 收藏, 编辑 接上一篇<Zookeeper C API 指南二(监视(Wathes), 基本常量和结构体介绍 ...

  4. 029 RDD Join相关API,以及程序

    1.数据集 A表数据: 1 a 2 b 3 c B表数据: 1 aa1 1 aa2 2 bb1 2 bb2 2 bb3 4 dd1 2.join的分类 inner join left outer jo ...

  5. 某音乐类App评论相关API的分析及SQL注入尝试

    关键字:APIfen.工具使用.sql注入 涉及工具/包:Fiddler.Burpsuite.Js2Py.Closure Compiler.selenium.phantomjs.sqlmap 摘要: ...

  6. Appium基础五:appium相关API

    1.获取信息类: 1.1 获取当前界面的组件: driver.currentActivity(); //获取当前界面的activity,可用于断言是否跳转到预期的activity 1.2 获取当前页面 ...

  7. Appium基础:appium相关API

    1.获取信息类: 1.1 获取当前界面的组件: driver.currentActivity(); //获取当前界面的activity,可用于断言是否跳转到预期的activity 1.2 获取当前页面 ...

  8. OC中并发编程的相关API和面临的挑战

    OC中并发编程的相关API和面临的挑战(1) 小引 http://www.objc.io/站点主要以杂志的形式,深入挖掘在OC中的最佳编程实践和高级技术,每个月探讨一个主题,每个主题都会有几篇相关的文 ...

  9. 【翻译】Flink Table Api & SQL — 用户定义函数

    本文翻译自官网:User-defined Functions  https://ci.apache.org/projects/flink/flink-docs-release-1.9/dev/tabl ...

随机推荐

  1. 零基础入门python爬虫(一)

    ✍写在前面: 欢迎加入纯干货技术交流群Disaster Army:317784952 接到5月25日之前要交稿的任务我就一门心思想写一篇爬虫入门的文章,可是我并不会.还好有将近一个月的时间去学习,于是 ...

  2. selenium配合phantomjs实现爬虫功能,并把抓取的数据写入excel

    # -*- coding: UTF-8 -*- ''' Created on 2016年5月13日 @author: csxie ''' import datetime from Base impor ...

  3. js遍历传参给html

    <p id="subp" hidden><button id= "upsub"shiro:hasPermission="sys:me ...

  4. appium常用的类库、对应的方法和属性

    1.driver.swipe(self, start_x, start_y, end_x, end_y, duration=None) tart_x - 滑动开始x轴坐标 start_y - 滑动开始 ...

  5. Android学习02

    今天学了ScrollView&HorizontalScrollView和WebView 一.ScrollView(垂直滚动),HorizontalScrollView(水平滚动) Scroll ...

  6. AFNetworking errorCode -1016 解决方法

    AFNetworking 默认是只能解析以下格式,如果需要支持data等格式,需要增加acceptableContentTypes AFNetworking.acceptableContentType ...

  7. 《一篇文章读懂HTTPS及其背后的加密原理》阅读笔记

    HTTPS(Hypertext Transfer Protocol Secure,超文本传输安全协议),是以安全为目标的HTTP通道,简单讲是HTTP的安全版.这篇文章深入介绍了它的原理. 当我们适用 ...

  8. 下载完idea后需要做的设置

    1.设置字体 2.安装插件 3.设置文件头(C:\Users\用户名\.IntelliJIdea2019.2\config\fileTemplates\includes下有个文件叫做File Head ...

  9. ubuntu 命令记录

    1.su root  进入root模式 2.ifconfig 查看ip地址 3.ls 查看文件 4./etc/init.d/matrix-gui-2.0 stop 关闭matrix界面 5.cd /文 ...

  10. JavaScript位置:window&client&offset&scroll&MouseEvent&getBoundingClientRect&计算任意元素滚动条宽度

    Window: window.innerWidth:浏览器viewport视口宽,包括垂直滚动条 window.innerHeight:浏览器视口高,包括水平滚动条 window.outerWidth ...