Adding ModifyFeature interaction
This is a first draft. The way geometry changes are handled for now is a bit clumsy. Both updating the feature cache RTree and making the layer aware of feature and geometry changes could be handled in a smarter way if these changes would be made through the layer instead of directly on the geometry or feature.
This commit is contained in:
@@ -26,6 +26,12 @@ ol.interaction.Drag = function() {
|
||||
*/
|
||||
this.dragging_ = false;
|
||||
|
||||
/**
|
||||
* @type {number} Delta for INTERACTING view hint. Subclasses that do not want
|
||||
* the INTERACTING hint to be set should override this to 0.
|
||||
*/
|
||||
this.interactingHint = 1;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
@@ -60,6 +66,14 @@ ol.interaction.Drag = function() {
|
||||
goog.inherits(ol.interaction.Drag, ol.interaction.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether we're dragging.
|
||||
*/
|
||||
ol.interaction.Drag.prototype.getDragging = function() {
|
||||
return this.dragging_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Event.
|
||||
* @protected
|
||||
@@ -115,7 +129,7 @@ ol.interaction.Drag.prototype.handleMapBrowserEvent =
|
||||
goog.asserts.assertInstanceof(browserEvent, goog.events.BrowserEvent);
|
||||
this.deltaX = browserEvent.clientX - this.startX;
|
||||
this.deltaY = browserEvent.clientY - this.startY;
|
||||
view.setHint(ol.ViewHint.INTERACTING, -1);
|
||||
view.setHint(ol.ViewHint.INTERACTING, -this.interactingHint);
|
||||
this.dragging_ = false;
|
||||
this.handleDragEnd(mapBrowserEvent);
|
||||
}
|
||||
@@ -131,7 +145,7 @@ ol.interaction.Drag.prototype.handleMapBrowserEvent =
|
||||
(mapBrowserEvent.getCoordinate());
|
||||
var handled = this.handleDragStart(mapBrowserEvent);
|
||||
if (handled) {
|
||||
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||
view.setHint(ol.ViewHint.INTERACTING, this.interactingHint);
|
||||
this.dragging_ = true;
|
||||
mapBrowserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
|
||||
Reference in New Issue
Block a user