Merge pull request #1105 from twpayne/example-fixes

Example type-related fixes
This commit is contained in:
Tom Payne
2013-10-09 04:56:45 -07:00
3 changed files with 12 additions and 10 deletions
+6 -6
View File
@@ -55,7 +55,7 @@ var panToLondon = document.getElementById('pan-to-london');
panToLondon.addEventListener('click', function() { panToLondon.addEventListener('click', function() {
var pan = ol.animation.pan({ var pan = ol.animation.pan({
duration: 2000, duration: 2000,
source: view.getCenter() source: /** @type {ol.Coordinate} */ (view.getCenter())
}); });
map.beforeRender(pan); map.beforeRender(pan);
view.setCenter(london); view.setCenter(london);
@@ -66,7 +66,7 @@ elasticToMoscow.addEventListener('click', function() {
var pan = ol.animation.pan({ var pan = ol.animation.pan({
duration: 2000, duration: 2000,
easing: ol.easing.elastic, easing: ol.easing.elastic,
source: view.getCenter() source: /** @type {ol.Coordinate} */ (view.getCenter())
}); });
map.beforeRender(pan); map.beforeRender(pan);
view.setCenter(moscow); view.setCenter(moscow);
@@ -77,7 +77,7 @@ bounceToIstanbul.addEventListener('click', function() {
var pan = ol.animation.pan({ var pan = ol.animation.pan({
duration: 2000, duration: 2000,
easing: ol.easing.bounce, easing: ol.easing.bounce,
source: view.getCenter() source: /** @type {ol.Coordinate} */ (view.getCenter())
}); });
map.beforeRender(pan); map.beforeRender(pan);
view.setCenter(istanbul); view.setCenter(istanbul);
@@ -89,7 +89,7 @@ spinToRome.addEventListener('click', function() {
var start = +new Date(); var start = +new Date();
var pan = ol.animation.pan({ var pan = ol.animation.pan({
duration: duration, duration: duration,
source: view.getCenter(), source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start start: start
}); });
var rotate = ol.animation.rotate({ var rotate = ol.animation.rotate({
@@ -107,7 +107,7 @@ flyToBern.addEventListener('click', function() {
var start = +new Date(); var start = +new Date();
var pan = ol.animation.pan({ var pan = ol.animation.pan({
duration: duration, duration: duration,
source: view.getCenter(), source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start start: start
}); });
var bounce = ol.animation.bounce({ var bounce = ol.animation.bounce({
@@ -125,7 +125,7 @@ spiralToMadrid.addEventListener('click', function() {
var start = +new Date(); var start = +new Date();
var pan = ol.animation.pan({ var pan = ol.animation.pan({
duration: duration, duration: duration,
source: view.getCenter(), source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start start: start
}); });
var bounce = ol.animation.bounce({ var bounce = ol.animation.bounce({
+2 -1
View File
@@ -41,6 +41,7 @@ projectionSelect.on('change:value', function() {
var precisionInput = new ol.dom.Input(document.getElementById('precision')); var precisionInput = new ol.dom.Input(document.getElementById('precision'));
precisionInput.on('change:value', function() { precisionInput.on('change:value', function() {
var format = ol.coordinate.createStringXY(precisionInput.getValue()); var precision = /** @type {number} */ (precisionInput.getValueAsNumber());
var format = ol.coordinate.createStringXY(precision);
mousePositionControl.setCoordinateFormat(format); mousePositionControl.setCoordinateFormat(format);
}); });
+4 -3
View File
@@ -75,9 +75,10 @@ xhr.onload = function() {
} }
var view = new ol.View2D(); var view = new ol.View2D();
view.fitExtent([ view.fitExtent(
257596.65942095537, 6250898.984085131, [257596.65942095537, 6250898.984085131,
262082.55751844167, 6251854.446938695], map.getSize()); 262082.55751844167, 6251854.446938695],
/** @type {ol.Size} */ (map.getSize()));
map.setView(view); map.setView(view);
} }
}; };