Rename _ol_interaction_Interaction_ to Interaction

This commit is contained in:
Marc Jansen
2017-12-15 10:18:45 +01:00
committed by Tim Schaub
parent aa630c3682
commit 4a1d50730b
21 changed files with 109 additions and 105 deletions

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import MapBrowserEventType from '../MapBrowserEventType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
/**
* @classdesc
@@ -24,7 +24,7 @@ var _ol_interaction_DoubleClickZoom_ = function(opt_options) {
*/
this.delta_ = options.delta ? options.delta : 1;
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
handleEvent: _ol_interaction_DoubleClickZoom_.handleEvent
});
@@ -36,7 +36,7 @@ var _ol_interaction_DoubleClickZoom_ = function(opt_options) {
};
inherits(_ol_interaction_DoubleClickZoom_, _ol_interaction_Interaction_);
inherits(_ol_interaction_DoubleClickZoom_, Interaction);
/**
@@ -55,7 +55,7 @@ _ol_interaction_DoubleClickZoom_.handleEvent = function(mapBrowserEvent) {
var anchor = mapBrowserEvent.coordinate;
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
var view = map.getView();
_ol_interaction_Interaction_.zoomByDelta(
Interaction.zoomByDelta(
view, delta, anchor, this.duration_);
mapBrowserEvent.preventDefault();
stopEvent = true;

View File

@@ -8,7 +8,7 @@ import {TRUE} from '../functions.js';
import _ol_events_ from '../events.js';
import Event from '../events/Event.js';
import EventType from '../events/EventType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import {get as getProjection} from '../proj.js';
/**
@@ -25,7 +25,7 @@ var _ol_interaction_DragAndDrop_ = function(opt_options) {
var options = opt_options ? opt_options : {};
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
handleEvent: _ol_interaction_DragAndDrop_.handleEvent
});
@@ -63,7 +63,7 @@ var _ol_interaction_DragAndDrop_ = function(opt_options) {
};
inherits(_ol_interaction_DragAndDrop_, _ol_interaction_Interaction_);
inherits(_ol_interaction_DragAndDrop_, Interaction);
/**
@@ -176,7 +176,7 @@ _ol_interaction_DragAndDrop_.prototype.registerListeners_ = function() {
* @inheritDoc
*/
_ol_interaction_DragAndDrop_.prototype.setActive = function(active) {
_ol_interaction_Interaction_.prototype.setActive.call(this, active);
Interaction.prototype.setActive.call(this, active);
if (active) {
this.registerListeners_();
} else {
@@ -190,7 +190,7 @@ _ol_interaction_DragAndDrop_.prototype.setActive = function(active) {
*/
_ol_interaction_DragAndDrop_.prototype.setMap = function(map) {
this.unregisterListeners_();
_ol_interaction_Interaction_.prototype.setMap.call(this, map);
Interaction.prototype.setMap.call(this, map);
if (this.getActive()) {
this.registerListeners_();
}
@@ -278,4 +278,5 @@ _ol_interaction_DragAndDrop_.Event = function(type, file, opt_features, opt_proj
};
inherits(_ol_interaction_DragAndDrop_.Event, Event);
export default _ol_interaction_DragAndDrop_;

View File

@@ -6,7 +6,7 @@ import _ol_RotationConstraint_ from '../RotationConstraint.js';
import _ol_ViewHint_ from '../ViewHint.js';
import _ol_events_condition_ from '../events/condition.js';
import {FALSE} from '../functions.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
/**
@@ -77,7 +77,7 @@ _ol_interaction_DragRotate_.handleDragEvent_ = function(mapBrowserEvent) {
if (this.lastAngle_ !== undefined) {
var delta = theta - this.lastAngle_;
var rotation = view.getRotation();
_ol_interaction_Interaction_.rotateWithoutConstraints(
Interaction.rotateWithoutConstraints(
view, rotation - delta);
}
this.lastAngle_ = theta;
@@ -99,7 +99,7 @@ _ol_interaction_DragRotate_.handleUpEvent_ = function(mapBrowserEvent) {
var view = map.getView();
view.setHint(_ol_ViewHint_.INTERACTING, -1);
var rotation = view.getRotation();
_ol_interaction_Interaction_.rotate(view, rotation,
Interaction.rotate(view, rotation,
undefined, this.duration_);
return false;
};

View File

@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
import _ol_RotationConstraint_ from '../RotationConstraint.js';
import _ol_ViewHint_ from '../ViewHint.js';
import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
/**
@@ -89,13 +89,13 @@ _ol_interaction_DragRotateAndZoom_.handleDragEvent_ = function(mapBrowserEvent)
var view = map.getView();
if (view.getConstraints().rotation !== _ol_RotationConstraint_.disable && this.lastAngle_ !== undefined) {
var angleDelta = theta - this.lastAngle_;
_ol_interaction_Interaction_.rotateWithoutConstraints(
Interaction.rotateWithoutConstraints(
view, view.getRotation() - angleDelta);
}
this.lastAngle_ = theta;
if (this.lastMagnitude_ !== undefined) {
var resolution = this.lastMagnitude_ * (view.getResolution() / magnitude);
_ol_interaction_Interaction_.zoomWithoutConstraints(view, resolution);
Interaction.zoomWithoutConstraints(view, resolution);
}
if (this.lastMagnitude_ !== undefined) {
this.lastScaleDelta_ = this.lastMagnitude_ / magnitude;
@@ -119,8 +119,8 @@ _ol_interaction_DragRotateAndZoom_.handleUpEvent_ = function(mapBrowserEvent) {
var view = map.getView();
view.setHint(_ol_ViewHint_.INTERACTING, -1);
var direction = this.lastScaleDelta_ - 1;
_ol_interaction_Interaction_.rotate(view, view.getRotation());
_ol_interaction_Interaction_.zoom(view, view.getResolution(),
Interaction.rotate(view, view.getRotation());
Interaction.zoom(view, view.getResolution(),
undefined, this.duration_, direction);
this.lastScaleDelta_ = 0;
return false;

View File

@@ -26,7 +26,7 @@ import _ol_math_ from '../math.js';
* @extends {ol.Object}
* @api
*/
var _ol_interaction_Interaction_ = function(options) {
var Interaction = function(options) {
_ol_Object_.call(this);
@@ -45,7 +45,7 @@ var _ol_interaction_Interaction_ = function(options) {
};
inherits(_ol_interaction_Interaction_, _ol_Object_);
inherits(Interaction, _ol_Object_);
/**
@@ -54,7 +54,7 @@ inherits(_ol_interaction_Interaction_, _ol_Object_);
* @observable
* @api
*/
_ol_interaction_Interaction_.prototype.getActive = function() {
Interaction.prototype.getActive = function() {
return (
/** @type {boolean} */ this.get(_ol_interaction_Property_.ACTIVE)
);
@@ -66,7 +66,7 @@ _ol_interaction_Interaction_.prototype.getActive = function() {
* @return {ol.PluggableMap} Map.
* @api
*/
_ol_interaction_Interaction_.prototype.getMap = function() {
Interaction.prototype.getMap = function() {
return this.map_;
};
@@ -77,7 +77,7 @@ _ol_interaction_Interaction_.prototype.getMap = function() {
* @observable
* @api
*/
_ol_interaction_Interaction_.prototype.setActive = function(active) {
Interaction.prototype.setActive = function(active) {
this.set(_ol_interaction_Property_.ACTIVE, active);
};
@@ -88,7 +88,7 @@ _ol_interaction_Interaction_.prototype.setActive = function(active) {
* the map here.
* @param {ol.PluggableMap} map Map.
*/
_ol_interaction_Interaction_.prototype.setMap = function(map) {
Interaction.prototype.setMap = function(map) {
this.map_ = map;
};
@@ -98,7 +98,7 @@ _ol_interaction_Interaction_.prototype.setMap = function(map) {
* @param {ol.Coordinate} delta Delta.
* @param {number=} opt_duration Duration.
*/
_ol_interaction_Interaction_.pan = function(view, delta, opt_duration) {
Interaction.pan = function(view, delta, opt_duration) {
var currentCenter = view.getCenter();
if (currentCenter) {
var center = view.constrainCenter(
@@ -122,9 +122,9 @@ _ol_interaction_Interaction_.pan = function(view, delta, opt_duration) {
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
_ol_interaction_Interaction_.rotate = function(view, rotation, opt_anchor, opt_duration) {
Interaction.rotate = function(view, rotation, opt_anchor, opt_duration) {
rotation = view.constrainRotation(rotation, 0);
_ol_interaction_Interaction_.rotateWithoutConstraints(
Interaction.rotateWithoutConstraints(
view, rotation, opt_anchor, opt_duration);
};
@@ -135,7 +135,7 @@ _ol_interaction_Interaction_.rotate = function(view, rotation, opt_anchor, opt_d
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
_ol_interaction_Interaction_.rotateWithoutConstraints = function(view, rotation, opt_anchor, opt_duration) {
Interaction.rotateWithoutConstraints = function(view, rotation, opt_anchor, opt_duration) {
if (rotation !== undefined) {
var currentRotation = view.getRotation();
var currentCenter = view.getCenter();
@@ -167,9 +167,9 @@ _ol_interaction_Interaction_.rotateWithoutConstraints = function(view, rotation,
* will select the nearest resolution. If not defined 0 is
* assumed.
*/
_ol_interaction_Interaction_.zoom = function(view, resolution, opt_anchor, opt_duration, opt_direction) {
Interaction.zoom = function(view, resolution, opt_anchor, opt_duration, opt_direction) {
resolution = view.constrainResolution(resolution, 0, opt_direction);
_ol_interaction_Interaction_.zoomWithoutConstraints(
Interaction.zoomWithoutConstraints(
view, resolution, opt_anchor, opt_duration);
};
@@ -180,7 +180,7 @@ _ol_interaction_Interaction_.zoom = function(view, resolution, opt_anchor, opt_d
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
_ol_interaction_Interaction_.zoomByDelta = function(view, delta, opt_anchor, opt_duration) {
Interaction.zoomByDelta = function(view, delta, opt_anchor, opt_duration) {
var currentResolution = view.getResolution();
var resolution = view.constrainResolution(currentResolution, delta, 0);
@@ -208,7 +208,7 @@ _ol_interaction_Interaction_.zoomByDelta = function(view, delta, opt_anchor, opt
];
}
_ol_interaction_Interaction_.zoomWithoutConstraints(
Interaction.zoomWithoutConstraints(
view, resolution, opt_anchor, opt_duration);
};
@@ -219,7 +219,7 @@ _ol_interaction_Interaction_.zoomByDelta = function(view, delta, opt_anchor, opt
* @param {ol.Coordinate=} opt_anchor Anchor coordinate.
* @param {number=} opt_duration Duration.
*/
_ol_interaction_Interaction_.zoomWithoutConstraints = function(view, resolution, opt_anchor, opt_duration) {
Interaction.zoomWithoutConstraints = function(view, resolution, opt_anchor, opt_duration) {
if (resolution) {
var currentResolution = view.getResolution();
var currentCenter = view.getCenter();
@@ -240,4 +240,4 @@ _ol_interaction_Interaction_.zoomWithoutConstraints = function(view, resolution,
}
}
};
export default _ol_interaction_Interaction_;
export default Interaction;

View File

@@ -6,7 +6,7 @@ import _ol_coordinate_ from '../coordinate.js';
import EventType from '../events/EventType.js';
import _ol_events_KeyCode_ from '../events/KeyCode.js';
import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
/**
* @classdesc
@@ -27,7 +27,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
*/
var _ol_interaction_KeyboardPan_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
handleEvent: _ol_interaction_KeyboardPan_.handleEvent
});
@@ -65,7 +65,7 @@ var _ol_interaction_KeyboardPan_ = function(opt_options) {
};
inherits(_ol_interaction_KeyboardPan_, _ol_interaction_Interaction_);
inherits(_ol_interaction_KeyboardPan_, Interaction);
/**
* Handles the {@link ol.MapBrowserEvent map browser event} if it was a
@@ -101,7 +101,7 @@ _ol_interaction_KeyboardPan_.handleEvent = function(mapBrowserEvent) {
}
var delta = [deltaX, deltaY];
_ol_coordinate_.rotate(delta, view.getRotation());
_ol_interaction_Interaction_.pan(view, delta, this.duration_);
Interaction.pan(view, delta, this.duration_);
mapBrowserEvent.preventDefault();
stopEvent = true;
}

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import EventType from '../events/EventType.js';
import _ol_events_condition_ from '../events/condition.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
/**
* @classdesc
@@ -25,7 +25,7 @@ import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
*/
var _ol_interaction_KeyboardZoom_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
handleEvent: _ol_interaction_KeyboardZoom_.handleEvent
});
@@ -52,7 +52,7 @@ var _ol_interaction_KeyboardZoom_ = function(opt_options) {
};
inherits(_ol_interaction_KeyboardZoom_, _ol_interaction_Interaction_);
inherits(_ol_interaction_KeyboardZoom_, Interaction);
/**
@@ -75,7 +75,7 @@ _ol_interaction_KeyboardZoom_.handleEvent = function(mapBrowserEvent) {
var map = mapBrowserEvent.map;
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
var view = map.getView();
_ol_interaction_Interaction_.zoomByDelta(
Interaction.zoomByDelta(
view, delta, undefined, this.duration_);
mapBrowserEvent.preventDefault();
stopEvent = true;

View File

@@ -6,7 +6,7 @@ import _ol_ViewHint_ from '../ViewHint.js';
import {easeOut} from '../easing.js';
import EventType from '../events/EventType.js';
import _ol_has_ from '../has.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import _ol_math_ from '../math.js';
@@ -27,7 +27,7 @@ var MAX_DELTA = 1;
*/
var _ol_interaction_MouseWheelZoom_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
handleEvent: _ol_interaction_MouseWheelZoom_.handleEvent
});
@@ -115,7 +115,7 @@ var _ol_interaction_MouseWheelZoom_ = function(opt_options) {
};
inherits(_ol_interaction_MouseWheelZoom_, _ol_interaction_Interaction_);
inherits(_ol_interaction_MouseWheelZoom_, Interaction);
/**
@@ -261,7 +261,7 @@ _ol_interaction_MouseWheelZoom_.prototype.handleWheelZoom_ = function(map) {
}
var maxDelta = MAX_DELTA;
var delta = _ol_math_.clamp(this.delta_, -maxDelta, maxDelta);
_ol_interaction_Interaction_.zoomByDelta(view, -delta, this.lastAnchor_,
Interaction.zoomByDelta(view, -delta, this.lastAnchor_,
this.duration_);
this.mode_ = undefined;
this.delta_ = 0;

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import _ol_ViewHint_ from '../ViewHint.js';
import {FALSE} from '../functions.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
import _ol_RotationConstraint_ from '../RotationConstraint.js';
@@ -115,7 +115,7 @@ _ol_interaction_PinchRotate_.handleDragEvent_ = function(mapBrowserEvent) {
if (this.rotating_) {
var rotation = view.getRotation();
map.render();
_ol_interaction_Interaction_.rotateWithoutConstraints(view,
Interaction.rotateWithoutConstraints(view,
rotation + rotationDelta, this.anchor_);
}
};
@@ -134,7 +134,7 @@ _ol_interaction_PinchRotate_.handleUpEvent_ = function(mapBrowserEvent) {
view.setHint(_ol_ViewHint_.INTERACTING, -1);
if (this.rotating_) {
var rotation = view.getRotation();
_ol_interaction_Interaction_.rotate(
Interaction.rotate(
view, rotation, this.anchor_, this.duration_);
}
return false;

View File

@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import _ol_ViewHint_ from '../ViewHint.js';
import {FALSE} from '../functions.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
/**
@@ -111,7 +111,7 @@ _ol_interaction_PinchZoom_.handleDragEvent_ = function(mapBrowserEvent) {
// scale, bypass the resolution constraint
map.render();
_ol_interaction_Interaction_.zoomWithoutConstraints(view, newResolution, this.anchor_);
Interaction.zoomWithoutConstraints(view, newResolution, this.anchor_);
};
@@ -134,7 +134,7 @@ _ol_interaction_PinchZoom_.handleUpEvent_ = function(mapBrowserEvent) {
// direction not to zoom out/in if user was pinching in/out.
// Direction is > 0 if pinching out, and < 0 if pinching in.
var direction = this.lastScaleDelta_ - 1;
_ol_interaction_Interaction_.zoom(view, resolution,
Interaction.zoom(view, resolution,
this.anchor_, this.duration_, direction);
}
return false;

View File

@@ -5,7 +5,7 @@ import {inherits, nullFunction} from '../index.js';
import {FALSE} from '../functions.js';
import MapBrowserEventType from '../MapBrowserEventType.js';
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import _ol_obj_ from '../obj.js';
/**
@@ -30,7 +30,7 @@ var _ol_interaction_Pointer_ = function(opt_options) {
var handleEvent = options.handleEvent ?
options.handleEvent : _ol_interaction_Pointer_.handleEvent;
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
handleEvent: handleEvent
});
@@ -82,7 +82,7 @@ var _ol_interaction_Pointer_ = function(opt_options) {
};
inherits(_ol_interaction_Pointer_, _ol_interaction_Interaction_);
inherits(_ol_interaction_Pointer_, Interaction);
/**
@@ -220,4 +220,5 @@ _ol_interaction_Pointer_.handleEvent = function(mapBrowserEvent) {
_ol_interaction_Pointer_.prototype.shouldStopEvent = function(handled) {
return handled;
};
export default _ol_interaction_Pointer_;

View File

@@ -9,7 +9,7 @@ import Event from '../events/Event.js';
import _ol_events_condition_ from '../events/condition.js';
import {TRUE} from '../functions.js';
import GeometryType from '../geom/GeometryType.js';
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
import Interaction from '../interaction/Interaction.js';
import _ol_layer_Vector_ from '../layer/Vector.js';
import _ol_obj_ from '../obj.js';
import _ol_source_Vector_ from '../source/Vector.js';
@@ -35,7 +35,7 @@ import _ol_style_Style_ from '../style/Style.js';
*/
var _ol_interaction_Select_ = function(opt_options) {
_ol_interaction_Interaction_.call(this, {
Interaction.call(this, {
handleEvent: _ol_interaction_Select_.handleEvent
});
@@ -142,7 +142,7 @@ var _ol_interaction_Select_ = function(opt_options) {
};
inherits(_ol_interaction_Select_, _ol_interaction_Interaction_);
inherits(_ol_interaction_Select_, Interaction);
/**
@@ -315,7 +315,7 @@ _ol_interaction_Select_.prototype.setMap = function(map) {
if (currentMap) {
selectedFeatures.forEach(currentMap.unskipFeature, currentMap);
}
_ol_interaction_Interaction_.prototype.setMap.call(this, map);
Interaction.prototype.setMap.call(this, map);
this.featureOverlay_.setMap(map);
if (map) {
selectedFeatures.forEach(map.skipFeature, map);