Skip to content

Commit cad6a46

Browse files
Merge pull request #113 from jonataswalker/v2.5.0
Release v2.5.0
2 parents 4824162 + 9153d87 commit cad6a46

File tree

7 files changed

+35
-48
lines changed

7 files changed

+35
-48
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpenLayers 3 Custom Context Menu
1+
# OpenLayers Custom Context Menu
22

33
<p align="center">
44
<a href="https://travis-ci.org/jonataswalker/ol3-contextmenu">
@@ -21,12 +21,12 @@
2121
</a>
2222
</p>
2323

24-
A `contextmenu` extension for [OpenLayers 3](http://openlayers.org/). **Requires** OpenLayers **v3.11.0** or higher.
24+
A `contextmenu` extension for [OpenLayers](http://openlayers.org/). **Requires** OpenLayers **v3.11.0** or higher.
2525

2626
![contextmenu anim](https://raw.githubusercontent.com/jonataswalker/ol3-contextmenu/screenshot/images/anim.gif)
2727

2828
## Demo
29-
You can see [here a demo](http://rawgit.com/jonataswalker/ol3-contextmenu/master/examples/contextmenu.html) or [JSFiddle](http://jsfiddle.net/jonataswalker/ooxs1w5d/).
29+
You can see [here a demo](http://rawgit.com/jonataswalker/ol3-contextmenu/master/examples/contextmenu.html) or [JSFiddle](https://jsfiddle.net/jonataswalker/ooxs1w5d/).
3030

3131
## How to use it?
3232
##### CDN Hosted - [jsDelivr](http://www.jsdelivr.com/projects/openlayers.contextmenu)

build/ol3-contextmenu-debug.js

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*!
2-
* ol3-contextmenu - v2.4.1
3-
* Custom Context Menu for Openlayers 3
2+
* ol3-contextmenu - v2.5.0
3+
* Custom Context Menu for Openlayers
44
* https://github.com/jonataswalker/ol3-contextmenu
5-
* Built: Fri Jan 27 2017 07:46:19 GMT-0200 (BRST)
5+
* Built: Fri Feb 24 2017 15:11:20 GMT-0300 (BRT)
66
*/
77

88
(function (global, factory) {
@@ -76,37 +76,24 @@ var defaultItems = [
7676
text: 'Zoom In',
7777
classname: [CLASSNAME.zoomIn, CLASSNAME.icon].join(' '),
7878
callback: function (obj, map) {
79-
var view = map.getView(),
80-
pan = ol.animation.pan({
81-
duration: 1000,
82-
source: view.getCenter()
83-
}),
84-
zoom = ol.animation.zoom({
85-
duration: 1000,
86-
resolution: view.getResolution()
87-
});
88-
89-
map.beforeRender(pan, zoom);
90-
view.setCenter(obj.coordinate);
91-
view.setZoom(+view.getZoom() + 1);
79+
var view = map.getView();
80+
view.animate({
81+
zoom: +view.getZoom() + 1,
82+
duration: 700,
83+
center: obj.coordinate
84+
});
9285
}
9386
},
9487
{
9588
text: 'Zoom Out',
9689
classname: [CLASSNAME.zoomOut, CLASSNAME.icon].join(' '),
9790
callback: function (obj, map) {
98-
var view = map.getView(),
99-
pan = ol.animation.pan({
100-
duration: 1000,
101-
source: view.getCenter()
102-
}),
103-
zoom = ol.animation.zoom({
104-
duration: 1000,
105-
resolution: view.getResolution()
106-
});
107-
map.beforeRender(pan, zoom);
108-
view.setCenter(obj.coordinate);
109-
view.setZoom(+view.getZoom() - 1);
91+
var view = map.getView();
92+
view.animate({
93+
zoom: +view.getZoom() - 1,
94+
duration: 700,
95+
center: obj.coordinate
96+
});
11097
}
11198
}
11299
];
@@ -391,7 +378,7 @@ var Internal = function Internal(base) {
391378
/**
392379
* @type {Element}
393380
*/
394-
this.mapElement = undefined;
381+
this.viewport = undefined;
395382
/**
396383
* @type {ol.Coordinate}
397384
*/
@@ -428,7 +415,7 @@ var Internal = function Internal(base) {
428415

429416
Internal.prototype.init = function init (map) {
430417
this.map = map;
431-
this.mapElement = map.getTargetElement();
418+
this.viewport = map.getViewport();
432419
this.setListeners();
433420
this.Base.Html.createMenu();
434421

@@ -537,12 +524,12 @@ Internal.prototype.closeMenu = function closeMenu () {
537524
};
538525

539526
Internal.prototype.setListeners = function setListeners () {
540-
this.mapElement.addEventListener(
527+
this.viewport.addEventListener(
541528
this.Base.options.eventType, this.eventHandler, false);
542529
};
543530

544531
Internal.prototype.removeListeners = function removeListeners () {
545-
this.mapElement.removeEventListener(
532+
this.viewport.removeEventListener(
546533
this.Base.options.eventType, this.eventHandler, false);
547534
};
548535

build/ol3-contextmenu.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*!
2-
* ol3-contextmenu - v2.4.1
3-
* Custom Context Menu for Openlayers 3
2+
* ol3-contextmenu - v2.5.0
3+
* Custom Context Menu for Openlayers
44
* https://github.com/jonataswalker/ol3-contextmenu
5-
* Built: Fri Jan 27 2017 07:46:22 GMT-0200 (BRST)
5+
* Built: Fri Feb 24 2017 15:11:23 GMT-0300 (BRT)
66
*/
77
.ol-ctx-menu-container {
88
position: absolute;

build/ol3-contextmenu.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ol3-contextmenu.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/ol3-contextmenu.min.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ol3-contextmenu",
3-
"version": "2.4.1",
4-
"description": "Custom Context Menu for Openlayers 3",
3+
"version": "2.5.0",
4+
"description": "Custom Context Menu for Openlayers",
55
"main": "build/ol3-contextmenu.js",
66
"author": "Jonatas Walker",
77
"homepage": "https://github.com/jonataswalker/ol3-contextmenu",

0 commit comments

Comments
 (0)