Rename _ol_interaction_PinchZoom_ to PinchZoom

This commit is contained in:
Frederic Junod
2018-01-11 13:49:48 +01:00
parent 356cea1611
commit 120c42f7a4
4 changed files with 17 additions and 17 deletions

View File

@@ -1,14 +1,14 @@
import Map from '../src/ol/Map.js'; import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js'; import View from '../src/ol/View.js';
import {defaults as defaultInteractions} from '../src/ol/interaction.js'; import {defaults as defaultInteractions} from '../src/ol/interaction.js';
import _ol_interaction_PinchZoom_ from '../src/ol/interaction/PinchZoom.js'; import PinchZoom from '../src/ol/interaction/PinchZoom.js';
import TileLayer from '../src/ol/layer/Tile.js'; import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js'; import OSM from '../src/ol/source/OSM.js';
var map = new Map({ var map = new Map({
interactions: defaultInteractions({pinchZoom: false}).extend([ interactions: defaultInteractions({pinchZoom: false}).extend([
new _ol_interaction_PinchZoom_({ new PinchZoom({
constrainResolution: true // force zooming to a integer zoom constrainResolution: true // force zooming to a integer zoom
}) })
]), ]),

View File

@@ -11,7 +11,7 @@ import _ol_interaction_KeyboardPan_ from './interaction/KeyboardPan.js';
import _ol_interaction_KeyboardZoom_ from './interaction/KeyboardZoom.js'; import _ol_interaction_KeyboardZoom_ from './interaction/KeyboardZoom.js';
import MouseWheelZoom from './interaction/MouseWheelZoom.js'; import MouseWheelZoom from './interaction/MouseWheelZoom.js';
import _ol_interaction_PinchRotate_ from './interaction/PinchRotate.js'; import _ol_interaction_PinchRotate_ from './interaction/PinchRotate.js';
import _ol_interaction_PinchZoom_ from './interaction/PinchZoom.js'; import PinchZoom from './interaction/PinchZoom.js';
/** /**
@@ -75,7 +75,7 @@ export function defaults(opt_options) {
var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true; var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
if (pinchZoom) { if (pinchZoom) {
interactions.push(new _ol_interaction_PinchZoom_({ interactions.push(new PinchZoom({
constrainResolution: options.constrainResolution, constrainResolution: options.constrainResolution,
duration: options.zoomDuration duration: options.zoomDuration
})); }));

View File

@@ -17,12 +17,12 @@ import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
* @param {olx.interaction.PinchZoomOptions=} opt_options Options. * @param {olx.interaction.PinchZoomOptions=} opt_options Options.
* @api * @api
*/ */
var _ol_interaction_PinchZoom_ = function(opt_options) { var PinchZoom = function(opt_options) {
_ol_interaction_Pointer_.call(this, { _ol_interaction_Pointer_.call(this, {
handleDownEvent: _ol_interaction_PinchZoom_.handleDownEvent_, handleDownEvent: PinchZoom.handleDownEvent_,
handleDragEvent: _ol_interaction_PinchZoom_.handleDragEvent_, handleDragEvent: PinchZoom.handleDragEvent_,
handleUpEvent: _ol_interaction_PinchZoom_.handleUpEvent_ handleUpEvent: PinchZoom.handleUpEvent_
}); });
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
@@ -59,7 +59,7 @@ var _ol_interaction_PinchZoom_ = function(opt_options) {
}; };
inherits(_ol_interaction_PinchZoom_, _ol_interaction_Pointer_); inherits(PinchZoom, _ol_interaction_Pointer_);
/** /**
@@ -67,7 +67,7 @@ inherits(_ol_interaction_PinchZoom_, _ol_interaction_Pointer_);
* @this {ol.interaction.PinchZoom} * @this {ol.interaction.PinchZoom}
* @private * @private
*/ */
_ol_interaction_PinchZoom_.handleDragEvent_ = function(mapBrowserEvent) { PinchZoom.handleDragEvent_ = function(mapBrowserEvent) {
var scaleDelta = 1.0; var scaleDelta = 1.0;
var touch0 = this.targetPointers[0]; var touch0 = this.targetPointers[0];
@@ -121,7 +121,7 @@ _ol_interaction_PinchZoom_.handleDragEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.PinchZoom} * @this {ol.interaction.PinchZoom}
* @private * @private
*/ */
_ol_interaction_PinchZoom_.handleUpEvent_ = function(mapBrowserEvent) { PinchZoom.handleUpEvent_ = function(mapBrowserEvent) {
if (this.targetPointers.length < 2) { if (this.targetPointers.length < 2) {
var map = mapBrowserEvent.map; var map = mapBrowserEvent.map;
var view = map.getView(); var view = map.getView();
@@ -150,7 +150,7 @@ _ol_interaction_PinchZoom_.handleUpEvent_ = function(mapBrowserEvent) {
* @this {ol.interaction.PinchZoom} * @this {ol.interaction.PinchZoom}
* @private * @private
*/ */
_ol_interaction_PinchZoom_.handleDownEvent_ = function(mapBrowserEvent) { PinchZoom.handleDownEvent_ = function(mapBrowserEvent) {
if (this.targetPointers.length >= 2) { if (this.targetPointers.length >= 2) {
var map = mapBrowserEvent.map; var map = mapBrowserEvent.map;
this.anchor_ = null; this.anchor_ = null;
@@ -169,5 +169,5 @@ _ol_interaction_PinchZoom_.handleDownEvent_ = function(mapBrowserEvent) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_interaction_PinchZoom_.prototype.shouldStopEvent = FALSE; PinchZoom.prototype.shouldStopEvent = FALSE;
export default _ol_interaction_PinchZoom_; export default PinchZoom;

View File

@@ -9,7 +9,7 @@ import {defaults as defaultInteractions} from '../../../src/ol/interaction.js';
import DoubleClickZoom from '../../../src/ol/interaction/DoubleClickZoom.js'; import DoubleClickZoom from '../../../src/ol/interaction/DoubleClickZoom.js';
import Interaction from '../../../src/ol/interaction/Interaction.js'; import Interaction from '../../../src/ol/interaction/Interaction.js';
import MouseWheelZoom from '../../../src/ol/interaction/MouseWheelZoom.js'; import MouseWheelZoom from '../../../src/ol/interaction/MouseWheelZoom.js';
import _ol_interaction_PinchZoom_ from '../../../src/ol/interaction/PinchZoom.js'; import PinchZoom from '../../../src/ol/interaction/PinchZoom.js';
import TileLayer from '../../../src/ol/layer/Tile.js'; import TileLayer from '../../../src/ol/layer/Tile.js';
import VectorLayer from '../../../src/ol/layer/Vector.js'; import VectorLayer from '../../../src/ol/layer/Vector.js';
import _ol_renderer_canvas_IntermediateCanvas_ from '../../../src/ol/renderer/canvas/IntermediateCanvas.js'; import _ol_renderer_canvas_IntermediateCanvas_ from '../../../src/ol/renderer/canvas/IntermediateCanvas.js';
@@ -509,7 +509,7 @@ describe('ol.Map', function() {
options.pinchZoom = true; options.pinchZoom = true;
var interactions = defaultInteractions(options); var interactions = defaultInteractions(options);
expect(interactions.getLength()).to.eql(1); expect(interactions.getLength()).to.eql(1);
expect(interactions.item(0)).to.be.a(_ol_interaction_PinchZoom_); expect(interactions.item(0)).to.be.a(PinchZoom);
expect(interactions.item(0).constrainResolution_).to.eql(false); expect(interactions.item(0).constrainResolution_).to.eql(false);
}); });
}); });
@@ -521,7 +521,7 @@ describe('ol.Map', function() {
options.constrainResolution = true; options.constrainResolution = true;
var interactions = defaultInteractions(options); var interactions = defaultInteractions(options);
expect(interactions.getLength()).to.eql(2); expect(interactions.getLength()).to.eql(2);
expect(interactions.item(0)).to.be.a(_ol_interaction_PinchZoom_); expect(interactions.item(0)).to.be.a(PinchZoom);
expect(interactions.item(0).constrainResolution_).to.eql(true); expect(interactions.item(0).constrainResolution_).to.eql(true);
expect(interactions.item(1)).to.be.a(MouseWheelZoom); expect(interactions.item(1)).to.be.a(MouseWheelZoom);
expect(interactions.item(1).constrainResolution_).to.eql(true); expect(interactions.item(1).constrainResolution_).to.eql(true);