Permalink
Browse files

4.1.8 with tooltips and wax.ol.Legend fix.

  • Loading branch information...
tmcw committed Feb 16, 2012
1 parent b0586cd commit 9493acc357d0c43470a5c5ec7e601f8c0de20c83
Showing with 189 additions and 21 deletions.
  1. +5 −0 CHANGELOG.md
  2. +27 −0 control/lib/tooltip.js
  3. +1 −1 control/ol/legend.js
  4. +28 −1 dist/wax.g.js
  5. +3 −3 dist/wax.g.min.js
  6. +28 −1 dist/wax.leaf.js
  7. +2 −2 dist/wax.leaf.min.js
  8. +28 −1 dist/wax.mm.js
  9. +3 −3 dist/wax.mm.min.js
  10. +29 −2 dist/wax.ol.js
  11. +3 −3 dist/wax.ol.min.js
  12. +28 −1 dist/wax.p.js
  13. +2 −2 dist/wax.p.min.js
  14. +1 −1 package.json
  15. +1 −0 theme/controls.css
View
@@ -1,5 +1,10 @@
## Changelog
+## 4.1.8
+
+* Fix `wax.ol.Legend`
+* Stop propagation of mouse events on tooltips, letting people scroll and click easily.
+
## 4.1.7
* Fixing click handler regex in Firefox due to absurd implementation bug
View
@@ -20,6 +20,33 @@ wax.tooltip.prototype.getTooltip = function(feature, context) {
tooltip.className = 'wax-tooltip wax-tooltip-0';
tooltip.innerHTML = feature;
context.appendChild(tooltip);
+
+ function addEv(obj, type, fn) {
+ if (obj.addEventListener) {
+ obj.addEventListener(type, fn, false);
+ if (type == 'mousewheel') {
+ obj.addEventListener('DOMMouseScroll', fn, false);
+ }
+ } else if (obj.attachEvent) {
+ obj['e'+type+fn] = fn;
+ obj[type+fn] = function(){ obj['e'+type+fn](window.event); };
+ obj.attachEvent('on'+type, obj[type+fn]);
+ }
+ }
+
+ function stop(e) {
+ e.cancelBubble = true;
+ if (e.stopPropagation) e.stopPropagation();
+ return this;
+ }
+
+ var mouseEvents = ['mousewheel', 'mousemove',
+ 'click', 'dblclick'];
+
+ for (var i = 0; i < mouseEvents.length; i++) {
+ addEv(tooltip, mouseEvents[i], stop);
+ }
+
return tooltip;
};
View
@@ -16,7 +16,7 @@ wax.ol.Legend = OpenLayers.Class(OpenLayers.Control, {
},
activate: function() {
- this.legend = new wax.Legend(this.map.viewPortDiv, this.options.container);
+ this.legend = new wax.legend(this.map.viewPortDiv, this.options.container);
return OpenLayers.Control.prototype.activate.apply(this, arguments);
},
View
@@ -1,4 +1,4 @@
-/* wax - 4.1.7 - 1.0.4-483-gbb64c65 */
+/* wax - 4.1.7 - 1.0.4-484-gb0586cd */
/*!
@@ -2084,6 +2084,33 @@ wax.tooltip.prototype.getTooltip = function(feature, context) {
tooltip.className = 'wax-tooltip wax-tooltip-0';
tooltip.innerHTML = feature;
context.appendChild(tooltip);
+
+ function addEv(obj, type, fn) {
+ if (obj.addEventListener) {
+ obj.addEventListener(type, fn, false);
+ if (type == 'mousewheel') {
+ obj.addEventListener('DOMMouseScroll', fn, false);
+ }
+ } else if (obj.attachEvent) {
+ obj['e'+type+fn] = fn;
+ obj[type+fn] = function(){ obj['e'+type+fn](window.event); };
+ obj.attachEvent('on'+type, obj[type+fn]);
+ }
+ }
+
+ function stop(e) {
+ e.cancelBubble = true;
+ if (e.stopPropagation) e.stopPropagation();
+ return this;
+ }
+
+ var mouseEvents = ['mousewheel', 'mousemove',
+ 'click', 'dblclick'];
+
+ for (var i = 0; i < mouseEvents.length; i++) {
+ addEv(tooltip, mouseEvents[i], stop);
+ }
+
return tooltip;
};
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 4.1.7 - 1.0.4-483-gbb64c65 */
+/* wax - 4.1.7 - 1.0.4-484-gb0586cd */
/*!
@@ -2084,6 +2084,33 @@ wax.tooltip.prototype.getTooltip = function(feature, context) {
tooltip.className = 'wax-tooltip wax-tooltip-0';
tooltip.innerHTML = feature;
context.appendChild(tooltip);
+
+ function addEv(obj, type, fn) {
+ if (obj.addEventListener) {
+ obj.addEventListener(type, fn, false);
+ if (type == 'mousewheel') {
+ obj.addEventListener('DOMMouseScroll', fn, false);
+ }
+ } else if (obj.attachEvent) {
+ obj['e'+type+fn] = fn;
+ obj[type+fn] = function(){ obj['e'+type+fn](window.event); };
+ obj.attachEvent('on'+type, obj[type+fn]);
+ }
+ }
+
+ function stop(e) {
+ e.cancelBubble = true;
+ if (e.stopPropagation) e.stopPropagation();
+ return this;
+ }
+
+ var mouseEvents = ['mousewheel', 'mousemove',
+ 'click', 'dblclick'];
+
+ for (var i = 0; i < mouseEvents.length; i++) {
+ addEv(tooltip, mouseEvents[i], stop);
+ }
+
return tooltip;
};
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 4.1.7 - 1.0.4-483-gbb64c65 */
+/* wax - 4.1.7 - 1.0.4-484-gb0586cd */
/*!
@@ -2084,6 +2084,33 @@ wax.tooltip.prototype.getTooltip = function(feature, context) {
tooltip.className = 'wax-tooltip wax-tooltip-0';
tooltip.innerHTML = feature;
context.appendChild(tooltip);
+
+ function addEv(obj, type, fn) {
+ if (obj.addEventListener) {
+ obj.addEventListener(type, fn, false);
+ if (type == 'mousewheel') {
+ obj.addEventListener('DOMMouseScroll', fn, false);
+ }
+ } else if (obj.attachEvent) {
+ obj['e'+type+fn] = fn;
+ obj[type+fn] = function(){ obj['e'+type+fn](window.event); };
+ obj.attachEvent('on'+type, obj[type+fn]);
+ }
+ }
+
+ function stop(e) {
+ e.cancelBubble = true;
+ if (e.stopPropagation) e.stopPropagation();
+ return this;
+ }
+
+ var mouseEvents = ['mousewheel', 'mousemove',
+ 'click', 'dblclick'];
+
+ for (var i = 0; i < mouseEvents.length; i++) {
+ addEv(tooltip, mouseEvents[i], stop);
+ }
+
return tooltip;
};
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 4.1.7 - 1.0.4-483-gbb64c65 */
+/* wax - 4.1.7 - 1.0.4-484-gb0586cd */
/*!
@@ -2102,6 +2102,33 @@ wax.tooltip.prototype.getTooltip = function(feature, context) {
tooltip.className = 'wax-tooltip wax-tooltip-0';
tooltip.innerHTML = feature;
context.appendChild(tooltip);
+
+ function addEv(obj, type, fn) {
+ if (obj.addEventListener) {
+ obj.addEventListener(type, fn, false);
+ if (type == 'mousewheel') {
+ obj.addEventListener('DOMMouseScroll', fn, false);
+ }
+ } else if (obj.attachEvent) {
+ obj['e'+type+fn] = fn;
+ obj[type+fn] = function(){ obj['e'+type+fn](window.event); };
+ obj.attachEvent('on'+type, obj[type+fn]);
+ }
+ }
+
+ function stop(e) {
+ e.cancelBubble = true;
+ if (e.stopPropagation) e.stopPropagation();
+ return this;
+ }
+
+ var mouseEvents = ['mousewheel', 'mousemove',
+ 'click', 'dblclick'];
+
+ for (var i = 0; i < mouseEvents.length; i++) {
+ addEv(tooltip, mouseEvents[i], stop);
+ }
+
return tooltip;
};
@@ -2584,7 +2611,7 @@ wax.ol.Legend = OpenLayers.Class(OpenLayers.Control, {
},
activate: function() {
- this.legend = new wax.Legend(this.map.viewPortDiv, this.options.container);
+ this.legend = new wax.legend(this.map.viewPortDiv, this.options.container);
return OpenLayers.Control.prototype.activate.apply(this, arguments);
},
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 4.1.7 - 1.0.4-483-gbb64c65 */
+/* wax - 4.1.7 - 1.0.4-484-gb0586cd */
/*!
@@ -720,6 +720,33 @@ wax.tooltip.prototype.getTooltip = function(feature, context) {
tooltip.className = 'wax-tooltip wax-tooltip-0';
tooltip.innerHTML = feature;
context.appendChild(tooltip);
+
+ function addEv(obj, type, fn) {
+ if (obj.addEventListener) {
+ obj.addEventListener(type, fn, false);
+ if (type == 'mousewheel') {
+ obj.addEventListener('DOMMouseScroll', fn, false);
+ }
+ } else if (obj.attachEvent) {
+ obj['e'+type+fn] = fn;
+ obj[type+fn] = function(){ obj['e'+type+fn](window.event); };
+ obj.attachEvent('on'+type, obj[type+fn]);
+ }
+ }
+
+ function stop(e) {
+ e.cancelBubble = true;
+ if (e.stopPropagation) e.stopPropagation();
+ return this;
+ }
+
+ var mouseEvents = ['mousewheel', 'mousemove',
+ 'click', 'dblclick'];
+
+ for (var i = 0; i < mouseEvents.length; i++) {
+ addEv(tooltip, mouseEvents[i], stop);
+ }
+
return tooltip;
};
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "wax",
- "version": "4.1.7",
+ "version": "4.1.8",
"description": "Tools for improving web maps.",
"repository": {
"type": "git",
View
@@ -61,6 +61,7 @@ a.zoomer {
position:absolute;
background:#333;
color:#fff;
+ -webkit-user-select:auto;
padding:10px;
left:10px;
top:10px;

0 comments on commit 9493acc

Please sign in to comment.