Commit 98b6361a authored by David Schnur's avatar David Schnur

Preserve canvas elements on re-plot.

Since the Canvas .text object is jQuery-wrapped, it was not preserved as
expected when clearing the canvas of junk.  I've replaced the selection
with one based on element classes.
parent d2642e80
...@@ -189,13 +189,15 @@ Licensed under the MIT license. ...@@ -189,13 +189,15 @@ Licensed under the MIT license.
// Add the HTML text layer, if it doesn't already exist // Add the HTML text layer, if it doesn't already exist
if (!this.text) { if (!this.text) {
this.text = $("<div></div>").css({ this.text = $("<div></div>")
position: "absolute", .addClass("flot-text")
top: 0, .css({
left: 0, position: "absolute",
bottom: 0, top: 0,
right: 0 left: 0,
}).insertAfter(this.element); bottom: 0,
right: 0
}).insertAfter(this.element);
} }
this.text.append(this._textBuffer); this.text.append(this._textBuffer);
...@@ -1122,7 +1124,7 @@ Licensed under the MIT license. ...@@ -1122,7 +1124,7 @@ Licensed under the MIT license.
// then whack any remaining obvious garbage left // then whack any remaining obvious garbage left
eventHolder.unbind(); eventHolder.unbind();
placeholder.children().not([surface.element, surface.text, overlay.element, overlay.text]).remove(); placeholder.children(":not(.flot-base,.flot-overlay,.flot-text)").remove();
} }
// save in case we get replotted // save in case we get replotted
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment