projects
/
dygraphs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
eced46c
)
Took a while to get conditional show to work; works in the case where you zoom in...
author
Robert Konigsberg
<konigsberg@google.com>
Fri, 4 Jan 2013 19:45:20 +0000
(14:45 -0500)
committer
Robert Konigsberg
<konigsberg@google.com>
Fri, 4 Jan 2013 19:45:20 +0000
(14:45 -0500)
plugins/unzoom.js
patch
|
blob
|
blame
|
history
diff --git
a/plugins/unzoom.js
b/plugins/unzoom.js
index
32d185b
..
8eefcf3
100644
(file)
--- a/
plugins/unzoom.js
+++ b/
plugins/unzoom.js
@@
-35,6
+35,7
@@
Dygraph.Plugins.Unzoom = (function() {
*/
var unzoom = function() {
this.button_ = null;
*/
var unzoom = function() {
this.button_ = null;
+ this.over_ = false;
};
unzoom.prototype.toString = function() {
};
unzoom.prototype.toString = function() {
@@
-51,6
+52,9
@@
Dygraph.Plugins.Unzoom = (function() {
var g = e.dygraph;
if (this.button_ != null) {
var g = e.dygraph;
if (this.button_ != null) {
+ if (g.isZoomed() && this.over_) {
+ this.show(true);
+ }
return;
}
return;
}
@@
-69,16
+73,24
@@
Dygraph.Plugins.Unzoom = (function() {
// TODO(konigsberg): doUnzoom_ is private.
g.doUnzoom_();
}
// TODO(konigsberg): doUnzoom_ is private.
g.doUnzoom_();
}
+
g.addEvent(parent, 'mouseover', function() {
g.addEvent(parent, 'mouseover', function() {
- self.button_.style.display='block';
+ if (g.isZoomed()) {
+ self.show(true);
+ }
+ self.over_ = true;
});
});
- // TODO(konigsberg): Don't show unless the graph is zoomed.
g.addEvent(parent, 'mouseout', function() {
g.addEvent(parent, 'mouseout', function() {
- self.button_.style.display='none';
+ self.show(false);
+ self.over_ = false;
});
};
});
};
+ unzoom.prototype.show = function(enabled) {
+ this.button_.style.display = enabled ? 'block' : 'none';
+ };
+
unzoom.prototype.destroy = function() {
this.button_.parentElement.removeChild(this.button_);
};
unzoom.prototype.destroy = function() {
this.button_.parentElement.removeChild(this.button_);
};