octopus-map
Version:
基于openlayer V6.6.1 为基础,进行二次开发的地图工具包,通过二次封装,简化 openlayer 的开发难度
32 lines (29 loc) • 886 B
JavaScript
/**
*
* @description add some new mapBrowserEvent
*
* @author OctopusRoe
*
* @version 0.0.1
*
*/
/**
* @description Reature `true` if only the mouse right button click
*
* @param {import('ol/MapBrowserEvent').default} MapBrowserEvent Map browser event
* @return {Boolean} true if only the mouse right button click
*/
export function rightMouseDown (mapBrowserEvent) {
const originalEvent = mapBrowserEvent.originalEvent
return originalEvent.button === 2 && originalEvent.pointerType
}
/**
* @description Reature `true` if only the mouse wheel use
*
* @param {import('ol/MapBrowserEvent').default} mapBrowserEvent Map browser event
* @returns {Boolean} true if only the mouse wheel use
*/
export function mouseWheel (mapBrowserEvent) {
const originalEvent = mapBrowserEvent.originalEvent
return originalEvent.type === 'wheel'
}