react-map-gl-draw
Advanced tools
Comparing version 0.14.4 to 0.14.5
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.14.4", | ||
"version": "0.14.5", | ||
"author": "Xintong Xia <xintong@uber.com>", | ||
@@ -52,3 +52,3 @@ "repository": { | ||
}, | ||
"gitHead": "cd9b9c57ccd2d9b93f132cc87c6d053fc5d0fa91" | ||
"gitHead": "bdf147c441ad61bc0bdd67e374b6c375bb3c9e18" | ||
} |
@@ -382,3 +382,3 @@ // @flow | ||
this._updateFeature(selectedFeature, 'vertex', { vertexIndex, lngLat }); | ||
} else { | ||
} else if (this._matchesFeature(elem, selectedFeature)) { | ||
// dragging feature | ||
@@ -419,4 +419,4 @@ const dx = x - startDragPos.x; | ||
if (selectedFeatureId && this._isVertex(elem)) { | ||
const [, featureIndex, vertexIndex] = elem.id.split('.'); | ||
const feature = features && features[featureIndex]; | ||
const [, featureIndex, vertexIndex]: string[] = elem.id.split('.'); | ||
const feature = features && features[Number(featureIndex)]; | ||
if (selectedFeatureId === (feature && feature.id)) { | ||
@@ -564,3 +564,3 @@ this.setState({ | ||
// don't forward pan events to the underlying map when: | ||
// - the pan target is a feature/vertex/line | ||
// - the pan target is a vertex/line/the currently selected feature | ||
// - the user is dragging something around | ||
@@ -571,6 +571,5 @@ // - there is currently an uncommitted position | ||
if ( | ||
this._isFeature(evt.target) || | ||
this._isVertex(evt.target) || | ||
this._isLine(evt.target) || | ||
this.state.isDragging || | ||
(this._matchesFeature(evt.target, this._getSelectedFeature()) && this.state.isDragging) || | ||
this.state.uncommittedLngLat !== null | ||
@@ -620,2 +619,13 @@ ) { | ||
_matchesFeature = (elem: HTMLElement, feature: ?Feature) => { | ||
if (!this._isFeature(elem) || !feature) { | ||
return false; | ||
} | ||
const [, featureIndex]: string[] = elem.id.split('.'); | ||
const { features } = this.props; | ||
const elemFeature = features && features[Number(featureIndex)]; | ||
return elemFeature && feature.id === elemFeature.id; | ||
}; | ||
_getEventPosition = (evt: MjolnirEvent): { x: number, y: number } => { | ||
@@ -622,0 +632,0 @@ const { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
426285
4362