admin管理员组文章数量:1590132
ol/interaction/DragBox.js
父类
ol/interaction/Pointer-PointerInteraction
主要功能
让用户通过拖拽框选择矢量。
经常和module:ol/events/condition共同使用。
参数:DragBox({})
参数 | 类型 | 说明 |
---|---|---|
condition | module:ol/events/condition~Condition | 判断一个浏览器事件是否应该触发,默认是ol/events/condition~mouseActionButton. ol.events.condition.platformModifierKeyOnly代表必须按ctrl |
方法
函数名 | 参数 | 源码 | 返回值类型 | 功能 |
---|---|---|---|---|
on(type, listener) | type string或Array.< string> 事件或事件列表 listener function 监听器函数 |
Observable.js, line 155 | {module:ol/events~EventsKey | Array.module:ol/events~EventsKey} |
getGeometry() | 无 | interaction/DragBox.js, line 199 | {module:ol/geom/Polygon~Polygon} | 返回拖拽框的geometry |
/**
* @module ol/interaction/DragBox
*/
// FIXME draw drag box
import Event from '../events/Event.js';
import PointerInteraction from './Pointer.js';
import RenderBox from '../render/Box.js';
import {
mouseActionButton} from '../events/condition.js';
/**
* A function that takes a {@link module:ol/MapBrowserEvent} and two
* {@link module:ol/pixel~Pixel}s and returns a `{boolean}`. If the condition is met,
* true should be returned.
* @typedef {function(this: ?, import("../MapBrowserEvent.js").default, import("../pixel.js").Pixel, import("../pixel.js").Pixel):boolean} EndCondition
*/
/**
* @typedef {Object} Options
* @property {string} [className='ol-dragbox'] CSS class name for styling the box.
* @property {import("../events/condition.js").Condition} [condition] A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a boolean
* to indicate whether that event should be handled.
* Default is {@link ol/events/condition~mouseActionButton}.
* @property {number} [minArea=64] The minimum area of the box in pixel, this value is used by the default
* `boxEndCondition` function.
* @property {EndCondition} [boxEndCondition] A function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and two
* {@link module:ol/pixel~Pixel}s to indicate whether a `boxend` event should be fired.
* Default is `true` if the area of the box is bigger than the `minArea` option.
* @property {function(this:DragBox, import("../MapBrowserEvent.js").default):void} [onBoxEnd] Code to execute just
* before `boxend` is fired.
*/
/**
* @enum {string}
*/
const DragBoxEventType = {
/**
* Triggered upon drag box start.
* @event DragBoxEvent#boxstart
* @api
*/
BOXSTART: 'boxstart',
/**
* Triggered on drag when box is active.
* @event DragBoxEvent#boxdrag
* @api
*/
BOXDRAG: 'boxdrag',
/**
* Triggered upon drag box end.
* @event DragBoxEvent#boxend
* @api
*/
BOXEND: 'boxend',
/**
* Triggered upon drag box canceled.
* @event DragBoxEvent#box
本文标签: 源码OpenLayersoljsDragBox
版权声明:本文标题:OpenLayers源码解析11 olinteractionDragBox.js 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728075694a1144441.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论