pigeon-maps
Advanced tools
Comparing version 0.19.6 to 0.19.7
@@ -1600,2 +1600,4 @@ 'use strict'; | ||
startY: undefined, | ||
startLeft: undefined, | ||
startTop: undefined, | ||
deltaX: 0, | ||
@@ -1629,4 +1631,2 @@ deltaY: 0 | ||
if (isDescendentOf(event.target, dragRef.current)) { | ||
var _propsRef$current$onD, _propsRef$current; | ||
event.preventDefault(); | ||
@@ -1637,6 +1637,16 @@ setState({ | ||
startY: ('touches' in event ? event.touches[0] : event).clientY, | ||
startLeft: propsRef.current.left, | ||
startTop: propsRef.current.top, | ||
deltaX: 0, | ||
deltaY: 0 | ||
}); | ||
(_propsRef$current$onD = (_propsRef$current = propsRef.current).onDragStart) === null || _propsRef$current$onD === void 0 ? void 0 : _propsRef$current$onD.call(_propsRef$current); | ||
if (propsRef.current.onDragStart) { | ||
var _propsRef$current = propsRef.current, | ||
_left = _propsRef$current.left, | ||
_top = _propsRef$current.top, | ||
offset = _propsRef$current.offset, | ||
pixelToLatLng = _propsRef$current.pixelToLatLng; | ||
propsRef.current.onDragMove(pixelToLatLng([_left + (offset ? offset[0] : 0), _top + (offset ? offset[1] : 0)])); | ||
} | ||
} | ||
@@ -1653,13 +1663,17 @@ }; | ||
var y = ('touches' in event ? event.touches[0] : event).clientY; | ||
var deltaX = x - stateRef.current.startX; | ||
var deltaY = y - stateRef.current.startY; | ||
setState({ | ||
deltaX: x - stateRef.current.startX, | ||
deltaY: y - stateRef.current.startY | ||
deltaX: deltaX, | ||
deltaY: deltaY | ||
}); | ||
if (propsRef.current.onDragMove) { | ||
var _left = props.left, | ||
_top = props.top, | ||
offset = props.offset, | ||
pixelToLatLng = props.pixelToLatLng; | ||
propsRef.current.onDragMove(pixelToLatLng([_left + x - stateRef.current.startX + (offset ? offset[0] : 0), _top + y - stateRef.current.startY + (offset ? offset[1] : 0)])); | ||
var _propsRef$current2 = propsRef.current, | ||
offset = _propsRef$current2.offset, | ||
pixelToLatLng = _propsRef$current2.pixelToLatLng; | ||
var _stateRef$current = stateRef.current, | ||
_startLeft = _stateRef$current.startLeft, | ||
_startTop = _stateRef$current.startTop; | ||
propsRef.current.onDragMove(pixelToLatLng([_startLeft + deltaX + (offset ? offset[0] : 0), _startTop + deltaY + (offset ? offset[1] : 0)])); | ||
} | ||
@@ -1669,3 +1683,3 @@ }; | ||
var handleDragEnd = function handleDragEnd(event) { | ||
var _propsRef$current$onD2, _propsRef$current3; | ||
var _propsRef$current$onD, _propsRef$current4; | ||
@@ -1677,11 +1691,11 @@ if (!stateRef.current.isDragging) { | ||
event.preventDefault(); | ||
var _propsRef$current2 = propsRef.current, | ||
left = _propsRef$current2.left, | ||
top = _propsRef$current2.top, | ||
offset = _propsRef$current2.offset, | ||
pixelToLatLng = _propsRef$current2.pixelToLatLng; | ||
var _stateRef$current = stateRef.current, | ||
deltaX = _stateRef$current.deltaX, | ||
deltaY = _stateRef$current.deltaY; | ||
(_propsRef$current$onD2 = (_propsRef$current3 = propsRef.current).onDragEnd) === null || _propsRef$current$onD2 === void 0 ? void 0 : _propsRef$current$onD2.call(_propsRef$current3, pixelToLatLng([left + deltaX + (offset ? offset[0] : 0), top + deltaY + (offset ? offset[1] : 0)])); | ||
var _propsRef$current3 = propsRef.current, | ||
offset = _propsRef$current3.offset, | ||
pixelToLatLng = _propsRef$current3.pixelToLatLng; | ||
var _stateRef$current2 = stateRef.current, | ||
deltaX = _stateRef$current2.deltaX, | ||
deltaY = _stateRef$current2.deltaY, | ||
startLeft = _stateRef$current2.startLeft, | ||
startTop = _stateRef$current2.startTop; | ||
(_propsRef$current$onD = (_propsRef$current4 = propsRef.current).onDragEnd) === null || _propsRef$current$onD === void 0 ? void 0 : _propsRef$current$onD.call(_propsRef$current4, pixelToLatLng([startLeft + deltaX + (offset ? offset[0] : 0), startTop + deltaY + (offset ? offset[1] : 0)])); | ||
setState({ | ||
@@ -1691,2 +1705,4 @@ isDragging: false, | ||
startY: undefined, | ||
startLeft: undefined, | ||
startTop: undefined, | ||
deltaX: 0, | ||
@@ -1743,2 +1759,4 @@ deltaY: 0 | ||
deltaY = _state.deltaY, | ||
startLeft = _state.startLeft, | ||
startTop = _state.startTop, | ||
isDragging = _state.isDragging; | ||
@@ -1750,3 +1768,3 @@ return /*#__PURE__*/React__default.createElement("div", { | ||
position: 'absolute', | ||
transform: "translate(" + (left + deltaX) + "px, " + (top + deltaY) + "px)" | ||
transform: "translate(" + (isDragging ? startLeft + deltaX : left) + "px, " + (isDragging ? startTop + deltaY : top) + "px)" | ||
}), | ||
@@ -1753,0 +1771,0 @@ ref: dragRef, |
@@ -1593,2 +1593,4 @@ import React, { Component, useState, useRef, useEffect } from 'react'; | ||
startY: undefined, | ||
startLeft: undefined, | ||
startTop: undefined, | ||
deltaX: 0, | ||
@@ -1622,4 +1624,2 @@ deltaY: 0 | ||
if (isDescendentOf(event.target, dragRef.current)) { | ||
var _propsRef$current$onD, _propsRef$current; | ||
event.preventDefault(); | ||
@@ -1630,6 +1630,16 @@ setState({ | ||
startY: ('touches' in event ? event.touches[0] : event).clientY, | ||
startLeft: propsRef.current.left, | ||
startTop: propsRef.current.top, | ||
deltaX: 0, | ||
deltaY: 0 | ||
}); | ||
(_propsRef$current$onD = (_propsRef$current = propsRef.current).onDragStart) === null || _propsRef$current$onD === void 0 ? void 0 : _propsRef$current$onD.call(_propsRef$current); | ||
if (propsRef.current.onDragStart) { | ||
var _propsRef$current = propsRef.current, | ||
_left = _propsRef$current.left, | ||
_top = _propsRef$current.top, | ||
offset = _propsRef$current.offset, | ||
pixelToLatLng = _propsRef$current.pixelToLatLng; | ||
propsRef.current.onDragMove(pixelToLatLng([_left + (offset ? offset[0] : 0), _top + (offset ? offset[1] : 0)])); | ||
} | ||
} | ||
@@ -1646,13 +1656,17 @@ }; | ||
var y = ('touches' in event ? event.touches[0] : event).clientY; | ||
var deltaX = x - stateRef.current.startX; | ||
var deltaY = y - stateRef.current.startY; | ||
setState({ | ||
deltaX: x - stateRef.current.startX, | ||
deltaY: y - stateRef.current.startY | ||
deltaX: deltaX, | ||
deltaY: deltaY | ||
}); | ||
if (propsRef.current.onDragMove) { | ||
var _left = props.left, | ||
_top = props.top, | ||
offset = props.offset, | ||
pixelToLatLng = props.pixelToLatLng; | ||
propsRef.current.onDragMove(pixelToLatLng([_left + x - stateRef.current.startX + (offset ? offset[0] : 0), _top + y - stateRef.current.startY + (offset ? offset[1] : 0)])); | ||
var _propsRef$current2 = propsRef.current, | ||
offset = _propsRef$current2.offset, | ||
pixelToLatLng = _propsRef$current2.pixelToLatLng; | ||
var _stateRef$current = stateRef.current, | ||
_startLeft = _stateRef$current.startLeft, | ||
_startTop = _stateRef$current.startTop; | ||
propsRef.current.onDragMove(pixelToLatLng([_startLeft + deltaX + (offset ? offset[0] : 0), _startTop + deltaY + (offset ? offset[1] : 0)])); | ||
} | ||
@@ -1662,3 +1676,3 @@ }; | ||
var handleDragEnd = function handleDragEnd(event) { | ||
var _propsRef$current$onD2, _propsRef$current3; | ||
var _propsRef$current$onD, _propsRef$current4; | ||
@@ -1670,11 +1684,11 @@ if (!stateRef.current.isDragging) { | ||
event.preventDefault(); | ||
var _propsRef$current2 = propsRef.current, | ||
left = _propsRef$current2.left, | ||
top = _propsRef$current2.top, | ||
offset = _propsRef$current2.offset, | ||
pixelToLatLng = _propsRef$current2.pixelToLatLng; | ||
var _stateRef$current = stateRef.current, | ||
deltaX = _stateRef$current.deltaX, | ||
deltaY = _stateRef$current.deltaY; | ||
(_propsRef$current$onD2 = (_propsRef$current3 = propsRef.current).onDragEnd) === null || _propsRef$current$onD2 === void 0 ? void 0 : _propsRef$current$onD2.call(_propsRef$current3, pixelToLatLng([left + deltaX + (offset ? offset[0] : 0), top + deltaY + (offset ? offset[1] : 0)])); | ||
var _propsRef$current3 = propsRef.current, | ||
offset = _propsRef$current3.offset, | ||
pixelToLatLng = _propsRef$current3.pixelToLatLng; | ||
var _stateRef$current2 = stateRef.current, | ||
deltaX = _stateRef$current2.deltaX, | ||
deltaY = _stateRef$current2.deltaY, | ||
startLeft = _stateRef$current2.startLeft, | ||
startTop = _stateRef$current2.startTop; | ||
(_propsRef$current$onD = (_propsRef$current4 = propsRef.current).onDragEnd) === null || _propsRef$current$onD === void 0 ? void 0 : _propsRef$current$onD.call(_propsRef$current4, pixelToLatLng([startLeft + deltaX + (offset ? offset[0] : 0), startTop + deltaY + (offset ? offset[1] : 0)])); | ||
setState({ | ||
@@ -1684,2 +1698,4 @@ isDragging: false, | ||
startY: undefined, | ||
startLeft: undefined, | ||
startTop: undefined, | ||
deltaX: 0, | ||
@@ -1736,2 +1752,4 @@ deltaY: 0 | ||
deltaY = _state.deltaY, | ||
startLeft = _state.startLeft, | ||
startTop = _state.startTop, | ||
isDragging = _state.isDragging; | ||
@@ -1743,3 +1761,3 @@ return /*#__PURE__*/React.createElement("div", { | ||
position: 'absolute', | ||
transform: "translate(" + (left + deltaX) + "px, " + (top + deltaY) + "px)" | ||
transform: "translate(" + (isDragging ? startLeft + deltaX : left) + "px, " + (isDragging ? startTop + deltaY : top) + "px)" | ||
}), | ||
@@ -1746,0 +1764,0 @@ ref: dragRef, |
@@ -7,3 +7,3 @@ import React from 'react'; | ||
children?: React.ReactNode; | ||
onDragStart?: () => void; | ||
onDragStart?: (anchor: Point) => void; | ||
onDragMove?: (anchor: Point) => void; | ||
@@ -10,0 +10,0 @@ onDragEnd?: (anchor: Point) => void; |
{ | ||
"name": "pigeon-maps", | ||
"version": "0.19.6", | ||
"version": "0.19.7", | ||
"description": "ReactJS maps without external dependencies", | ||
@@ -5,0 +5,0 @@ "author": "Marius Andra", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5014
196656
26