remove arrow function, add JSDoc and restore original Draw
This commit is contained in:
@@ -230,14 +230,28 @@ export const mouseOnly = function(mapBrowserEvent) {
|
||||
return pointerEvent.pointerType == 'mouse';
|
||||
};
|
||||
|
||||
export const touchOnly = (mapBrowserEvent) => {
|
||||
/**
|
||||
* Return `true` if the event originates from a touchable device.
|
||||
*
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the event originates from a touchable device.
|
||||
* @api
|
||||
*/
|
||||
export const touchOnly = function(mapBrowserEvent) {
|
||||
const pointerEvt = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent).pointerEvent;
|
||||
assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||
return pointerEvt.pointerType === 'touch';
|
||||
};
|
||||
|
||||
export const penOnly = (mapBrowserEvent) => {
|
||||
/**
|
||||
* Return `true` if the event originates from a digital pen.
|
||||
*
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} True if the event originates from a digital pen.
|
||||
* @api
|
||||
*/
|
||||
export const penOnly = function(mapBrowserEvent) {
|
||||
const pointerEvt = /** @type {import("../MapBrowserPointerEvent").default} */ (mapBrowserEvent).pointerEvent;
|
||||
assert(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event
|
||||
// see http://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType
|
||||
|
||||
@@ -528,7 +528,7 @@ class Draw extends PointerInteraction {
|
||||
handleDownEvent(event) {
|
||||
this.shouldHandle_ = !this.freehand_;
|
||||
|
||||
if (this.freehand_ && ((this.condition_ && this.condition_(event)) || true)) {
|
||||
if (this.freehand_) {
|
||||
this.downPx_ = event.pixel;
|
||||
if (!this.finishCoordinate_) {
|
||||
this.startDrawing_(event);
|
||||
@@ -548,6 +548,7 @@ class Draw extends PointerInteraction {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user