Named exports from ol/easing
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import _ol_Map_ from '../src/ol/Map.js';
|
import _ol_Map_ from '../src/ol/Map.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import _ol_easing_ from '../src/ol/easing.js';
|
import {easeIn, easeOut} from '../src/ol/easing.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_proj_ from '../src/ol/proj.js';
|
import _ol_proj_ from '../src/ol/proj.js';
|
||||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||||
@@ -79,11 +79,11 @@ onClick('rotate-around-rome', function() {
|
|||||||
view.animate({
|
view.animate({
|
||||||
rotation: rotation + Math.PI,
|
rotation: rotation + Math.PI,
|
||||||
anchor: rome,
|
anchor: rome,
|
||||||
easing: _ol_easing_.easeIn
|
easing: easeIn
|
||||||
}, {
|
}, {
|
||||||
rotation: rotation + 2 * Math.PI,
|
rotation: rotation + 2 * Math.PI,
|
||||||
anchor: rome,
|
anchor: rome,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -119,11 +119,11 @@ onClick('spin-to-rome', function() {
|
|||||||
center[1] + (rome[1] - center[1]) / 2
|
center[1] + (rome[1] - center[1]) / 2
|
||||||
],
|
],
|
||||||
rotation: Math.PI,
|
rotation: Math.PI,
|
||||||
easing: _ol_easing_.easeIn
|
easing: easeIn
|
||||||
}, {
|
}, {
|
||||||
center: rome,
|
center: rome,
|
||||||
rotation: 2 * Math.PI,
|
rotation: 2 * Math.PI,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import _ol_Map_ from '../src/ol/Map.js';
|
|||||||
import _ol_Observable_ from '../src/ol/Observable.js';
|
import _ol_Observable_ from '../src/ol/Observable.js';
|
||||||
import _ol_View_ from '../src/ol/View.js';
|
import _ol_View_ from '../src/ol/View.js';
|
||||||
import _ol_control_ from '../src/ol/control.js';
|
import _ol_control_ from '../src/ol/control.js';
|
||||||
import _ol_easing_ from '../src/ol/easing.js';
|
import {easeOut} from '../src/ol/easing.js';
|
||||||
import _ol_geom_Point_ from '../src/ol/geom/Point.js';
|
import _ol_geom_Point_ from '../src/ol/geom/Point.js';
|
||||||
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
|
||||||
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
import _ol_layer_Vector_ from '../src/ol/layer/Vector.js';
|
||||||
@@ -64,8 +64,8 @@ function flash(feature) {
|
|||||||
var elapsed = frameState.time - start;
|
var elapsed = frameState.time - start;
|
||||||
var elapsedRatio = elapsed / duration;
|
var elapsedRatio = elapsed / duration;
|
||||||
// radius will be 5 at start and 30 at end.
|
// radius will be 5 at start and 30 at end.
|
||||||
var radius = _ol_easing_.easeOut(elapsedRatio) * 25 + 5;
|
var radius = easeOut(elapsedRatio) * 25 + 5;
|
||||||
var opacity = _ol_easing_.easeOut(1 - elapsedRatio);
|
var opacity = easeOut(1 - elapsedRatio);
|
||||||
|
|
||||||
var style = new _ol_style_Style_({
|
var style = new _ol_style_Style_({
|
||||||
image: new _ol_style_Circle_({
|
image: new _ol_style_Circle_({
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from './index.js';
|
import {inherits} from './index.js';
|
||||||
import _ol_TileState_ from './TileState.js';
|
import _ol_TileState_ from './TileState.js';
|
||||||
import _ol_easing_ from './easing.js';
|
import {easeIn} from './easing.js';
|
||||||
import _ol_events_EventTarget_ from './events/EventTarget.js';
|
import _ol_events_EventTarget_ from './events/EventTarget.js';
|
||||||
import _ol_events_EventType_ from './events/EventType.js';
|
import _ol_events_EventType_ from './events/EventType.js';
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ _ol_Tile_.prototype.getAlpha = function(id, time) {
|
|||||||
if (delta >= this.transition_) {
|
if (delta >= this.transition_) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return _ol_easing_.easeIn(delta / this.transition_);
|
return easeIn(delta / this.transition_);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import _ol_ViewProperty_ from './ViewProperty.js';
|
|||||||
import _ol_array_ from './array.js';
|
import _ol_array_ from './array.js';
|
||||||
import _ol_asserts_ from './asserts.js';
|
import _ol_asserts_ from './asserts.js';
|
||||||
import _ol_coordinate_ from './coordinate.js';
|
import _ol_coordinate_ from './coordinate.js';
|
||||||
import _ol_easing_ from './easing.js';
|
import {inAndOut} from './easing.js';
|
||||||
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
|
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
|
||||||
import _ol_geom_GeometryType_ from './geom/GeometryType.js';
|
import _ol_geom_GeometryType_ from './geom/GeometryType.js';
|
||||||
import _ol_geom_Polygon_ from './geom/Polygon.js';
|
import _ol_geom_Polygon_ from './geom/Polygon.js';
|
||||||
@@ -306,7 +306,7 @@ _ol_View_.prototype.animate = function(var_args) {
|
|||||||
complete: false,
|
complete: false,
|
||||||
anchor: options.anchor,
|
anchor: options.anchor,
|
||||||
duration: options.duration !== undefined ? options.duration : 1000,
|
duration: options.duration !== undefined ? options.duration : 1000,
|
||||||
easing: options.easing || _ol_easing_.inAndOut
|
easing: options.easing || inAndOut
|
||||||
});
|
});
|
||||||
|
|
||||||
if (options.center) {
|
if (options.center) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import _ol_control_Control_ from '../control/Control.js';
|
import _ol_control_Control_ from '../control/Control.js';
|
||||||
import _ol_css_ from '../css.js';
|
import _ol_css_ from '../css.js';
|
||||||
import _ol_easing_ from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import _ol_events_EventType_ from '../events/EventType.js';
|
import _ol_events_EventType_ from '../events/EventType.js';
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
@@ -127,7 +127,7 @@ _ol_control_Rotate_.prototype.resetNorth_ = function() {
|
|||||||
view.animate({
|
view.animate({
|
||||||
rotation: 0,
|
rotation: 0,
|
||||||
duration: this.duration_,
|
duration: this.duration_,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
view.setRotation(0);
|
view.setRotation(0);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import _ol_events_ from '../events.js';
|
|||||||
import _ol_events_EventType_ from '../events/EventType.js';
|
import _ol_events_EventType_ from '../events/EventType.js';
|
||||||
import _ol_control_Control_ from '../control/Control.js';
|
import _ol_control_Control_ from '../control/Control.js';
|
||||||
import _ol_css_ from '../css.js';
|
import _ol_css_ from '../css.js';
|
||||||
import _ol_easing_ from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
@@ -113,7 +113,7 @@ _ol_control_Zoom_.prototype.zoomByDelta_ = function(delta) {
|
|||||||
view.animate({
|
view.animate({
|
||||||
resolution: newResolution,
|
resolution: newResolution,
|
||||||
duration: this.duration_,
|
duration: this.duration_,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
view.setResolution(newResolution);
|
view.setResolution(newResolution);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {inherits} from '../index.js';
|
|||||||
import _ol_ViewHint_ from '../ViewHint.js';
|
import _ol_ViewHint_ from '../ViewHint.js';
|
||||||
import _ol_control_Control_ from '../control/Control.js';
|
import _ol_control_Control_ from '../control/Control.js';
|
||||||
import _ol_css_ from '../css.js';
|
import _ol_css_ from '../css.js';
|
||||||
import _ol_easing_ from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import _ol_events_ from '../events.js';
|
import _ol_events_ from '../events.js';
|
||||||
import _ol_events_Event_ from '../events/Event.js';
|
import _ol_events_Event_ from '../events/Event.js';
|
||||||
import _ol_events_EventType_ from '../events/EventType.js';
|
import _ol_events_EventType_ from '../events/EventType.js';
|
||||||
@@ -239,7 +239,7 @@ _ol_control_ZoomSlider_.prototype.handleContainerClick_ = function(event) {
|
|||||||
view.animate({
|
view.animate({
|
||||||
resolution: view.constrainResolution(resolution),
|
resolution: view.constrainResolution(resolution),
|
||||||
duration: this.duration_,
|
duration: this.duration_,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ _ol_control_ZoomSlider_.prototype.handleDraggerEnd_ = function(event) {
|
|||||||
view.animate({
|
view.animate({
|
||||||
resolution: view.constrainResolution(this.currentResolution_),
|
resolution: view.constrainResolution(this.currentResolution_),
|
||||||
duration: this.duration_,
|
duration: this.duration_,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
|
|
||||||
this.dragging_ = false;
|
this.dragging_ = false;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @module ol/easing
|
* @module ol/easing
|
||||||
*/
|
*/
|
||||||
var _ol_easing_ = {};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,9 +9,9 @@ var _ol_easing_ = {};
|
|||||||
* @return {number} Output between 0 and 1.
|
* @return {number} Output between 0 and 1.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_easing_.easeIn = function(t) {
|
export function easeIn(t) {
|
||||||
return Math.pow(t, 3);
|
return Math.pow(t, 3);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,9 +20,9 @@ _ol_easing_.easeIn = function(t) {
|
|||||||
* @return {number} Output between 0 and 1.
|
* @return {number} Output between 0 and 1.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_easing_.easeOut = function(t) {
|
export function easeOut(t) {
|
||||||
return 1 - _ol_easing_.easeIn(1 - t);
|
return 1 - easeIn(1 - t);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,9 +31,9 @@ _ol_easing_.easeOut = function(t) {
|
|||||||
* @return {number} Output between 0 and 1.
|
* @return {number} Output between 0 and 1.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_easing_.inAndOut = function(t) {
|
export function inAndOut(t) {
|
||||||
return 3 * t * t - 2 * t * t * t;
|
return 3 * t * t - 2 * t * t * t;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,9 +42,9 @@ _ol_easing_.inAndOut = function(t) {
|
|||||||
* @return {number} Output between 0 and 1.
|
* @return {number} Output between 0 and 1.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_easing_.linear = function(t) {
|
export function linear(t) {
|
||||||
return t;
|
return t;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,11 +55,10 @@ _ol_easing_.linear = function(t) {
|
|||||||
* @return {number} Output between 0 and 1.
|
* @return {number} Output between 0 and 1.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_easing_.upAndDown = function(t) {
|
export function upAndDown(t) {
|
||||||
if (t < 0.5) {
|
if (t < 0.5) {
|
||||||
return _ol_easing_.inAndOut(2 * t);
|
return inAndOut(2 * t);
|
||||||
} else {
|
} else {
|
||||||
return 1 - _ol_easing_.inAndOut(2 * (t - 0.5));
|
return 1 - inAndOut(2 * (t - 0.5));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
export default _ol_easing_;
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_ViewHint_ from '../ViewHint.js';
|
import _ol_ViewHint_ from '../ViewHint.js';
|
||||||
import _ol_coordinate_ from '../coordinate.js';
|
import _ol_coordinate_ from '../coordinate.js';
|
||||||
import _ol_easing_ from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import _ol_events_condition_ from '../events/condition.js';
|
||||||
import _ol_functions_ from '../functions.js';
|
import _ol_functions_ from '../functions.js';
|
||||||
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
import _ol_interaction_Pointer_ from '../interaction/Pointer.js';
|
||||||
@@ -120,7 +120,7 @@ _ol_interaction_DragPan_.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
view.animate({
|
view.animate({
|
||||||
center: view.constrainCenter(dest),
|
center: view.constrainCenter(dest),
|
||||||
duration: 500,
|
duration: 500,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
view.setHint(_ol_ViewHint_.INTERACTING, -1);
|
view.setHint(_ol_ViewHint_.INTERACTING, -1);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/interaction/DragZoom
|
* @module ol/interaction/DragZoom
|
||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_easing_ from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import _ol_events_condition_ from '../events/condition.js';
|
import _ol_events_condition_ from '../events/condition.js';
|
||||||
import {createOrUpdateFromCoordinates, getBottomLeft, getCenter, getTopRight, scaleFromCenter} from '../extent.js';
|
import {createOrUpdateFromCoordinates, getBottomLeft, getCenter, getTopRight, scaleFromCenter} from '../extent.js';
|
||||||
import _ol_interaction_DragBox_ from '../interaction/DragBox.js';
|
import _ol_interaction_DragBox_ from '../interaction/DragBox.js';
|
||||||
@@ -82,7 +82,7 @@ _ol_interaction_DragZoom_.prototype.onBoxEnd = function() {
|
|||||||
resolution: resolution,
|
resolution: resolution,
|
||||||
center: center,
|
center: center,
|
||||||
duration: this.duration_,
|
duration: this.duration_,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_Object_ from '../Object.js';
|
import _ol_Object_ from '../Object.js';
|
||||||
import _ol_easing_ from '../easing.js';
|
import {easeOut, linear} from '../easing.js';
|
||||||
import _ol_interaction_Property_ from '../interaction/Property.js';
|
import _ol_interaction_Property_ from '../interaction/Property.js';
|
||||||
import _ol_math_ from '../math.js';
|
import _ol_math_ from '../math.js';
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ _ol_interaction_Interaction_.pan = function(view, delta, opt_duration) {
|
|||||||
if (opt_duration) {
|
if (opt_duration) {
|
||||||
view.animate({
|
view.animate({
|
||||||
duration: opt_duration,
|
duration: opt_duration,
|
||||||
easing: _ol_easing_.linear,
|
easing: linear,
|
||||||
center: center
|
center: center
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -144,7 +144,7 @@ _ol_interaction_Interaction_.rotateWithoutConstraints = function(view, rotation,
|
|||||||
rotation: rotation,
|
rotation: rotation,
|
||||||
anchor: opt_anchor,
|
anchor: opt_anchor,
|
||||||
duration: opt_duration,
|
duration: opt_duration,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
view.rotate(rotation, opt_anchor);
|
view.rotate(rotation, opt_anchor);
|
||||||
@@ -229,7 +229,7 @@ _ol_interaction_Interaction_.zoomWithoutConstraints = function(view, resolution,
|
|||||||
resolution: resolution,
|
resolution: resolution,
|
||||||
anchor: opt_anchor,
|
anchor: opt_anchor,
|
||||||
duration: opt_duration,
|
duration: opt_duration,
|
||||||
easing: _ol_easing_.easeOut
|
easing: easeOut
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (opt_anchor) {
|
if (opt_anchor) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import {inherits} from '../index.js';
|
import {inherits} from '../index.js';
|
||||||
import _ol_ViewHint_ from '../ViewHint.js';
|
import _ol_ViewHint_ from '../ViewHint.js';
|
||||||
import _ol_easing_ from '../easing.js';
|
import {easeOut} from '../easing.js';
|
||||||
import _ol_events_EventType_ from '../events/EventType.js';
|
import _ol_events_EventType_ from '../events/EventType.js';
|
||||||
import _ol_has_ from '../has.js';
|
import _ol_has_ from '../has.js';
|
||||||
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
||||||
@@ -204,7 +204,7 @@ _ol_interaction_MouseWheelZoom_.handleEvent = function(mapBrowserEvent) {
|
|||||||
if (rebound === 0 && this.constrainResolution_) {
|
if (rebound === 0 && this.constrainResolution_) {
|
||||||
view.animate({
|
view.animate({
|
||||||
resolution: view.constrainResolution(resolution, delta > 0 ? -1 : 1),
|
resolution: view.constrainResolution(resolution, delta > 0 ? -1 : 1),
|
||||||
easing: _ol_easing_.easeOut,
|
easing: easeOut,
|
||||||
anchor: this.lastAnchor_,
|
anchor: this.lastAnchor_,
|
||||||
duration: this.duration_
|
duration: this.duration_
|
||||||
});
|
});
|
||||||
@@ -213,14 +213,14 @@ _ol_interaction_MouseWheelZoom_.handleEvent = function(mapBrowserEvent) {
|
|||||||
if (rebound > 0) {
|
if (rebound > 0) {
|
||||||
view.animate({
|
view.animate({
|
||||||
resolution: minResolution,
|
resolution: minResolution,
|
||||||
easing: _ol_easing_.easeOut,
|
easing: easeOut,
|
||||||
anchor: this.lastAnchor_,
|
anchor: this.lastAnchor_,
|
||||||
duration: 500
|
duration: 500
|
||||||
});
|
});
|
||||||
} else if (rebound < 0) {
|
} else if (rebound < 0) {
|
||||||
view.animate({
|
view.animate({
|
||||||
resolution: maxResolution,
|
resolution: maxResolution,
|
||||||
easing: _ol_easing_.easeOut,
|
easing: easeOut,
|
||||||
anchor: this.lastAnchor_,
|
anchor: this.lastAnchor_,
|
||||||
duration: 500
|
duration: 500
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user