Commit de8d3e2b authored by olau@iola.dk's avatar olau@iola.dk

Fixed IE 7 problem with selecting

git-svn-id: https://flot.googlecode.com/svn/trunk@48 1e0a6537-2640-0410-bfb7-f154510ff394
parent 0e91a090
...@@ -27,7 +27,9 @@ The option axis.tickFormatter now takes a function with two ...@@ -27,7 +27,9 @@ The option axis.tickFormatter now takes a function with two
parameters, the second parameter is an optional object with parameters, the second parameter is an optional object with
information about the axis. It has min, max, tickDecimals, tickSize. information about the axis. It has min, max, tickDecimals, tickSize.
Fixed a bug in handling single-item bar series (reported by Emil Filipov). Fixed a bug in handling single-item bar series (reported by Emil
Filipov). Fixed erratic behaviour when selecting with IE 7 (reported
by Lau Bech Lauritzen).
......
...@@ -95,6 +95,9 @@ ...@@ -95,6 +95,9 @@
var hozScale = 0; var hozScale = 0;
var vertScale = 0; var vertScale = 0;
// dedicated to storing data for buggy standard compliance cases
var workarounds = {};
// initialize // initialize
series = parseData(data_); series = parseData(data_);
parseOptions(options_); parseOptions(options_);
...@@ -172,6 +175,11 @@ ...@@ -172,6 +175,11 @@
function bindEvents() { function bindEvents() {
if (options.selection.mode != null) { if (options.selection.mode != null) {
$(overlay).mousedown(onMouseDown); $(overlay).mousedown(onMouseDown);
// we put the mouse down on canvas too, because IE 7 sometimes
// has trouble with the stacking order
$(canvas).mousedown(onMouseDown);
// FIXME: temp. work-around until jQuery bug 1871 is fixed // FIXME: temp. work-around until jQuery bug 1871 is fixed
target.get(0).onmousemove = onMouseMove; target.get(0).onmousemove = onMouseMove;
} }
...@@ -1302,6 +1310,21 @@ ...@@ -1302,6 +1310,21 @@
if (e.which != 1) // only accept left-click if (e.which != 1) // only accept left-click
return; return;
// cancel out any text selections
document.body.focus();
// prevent text selection in IE
if ($.browser == "msie") {
if (workarounds.onselectstart == null) {
workarounds.onselectstart = document.onselectstart;
document.onselectstart = function () { return false; };
}
if (workarounds.ondrag == null) {
workarounds.ondrag = document.ondrag;
document.ondrag = function () { return false; };
}
}
setSelectionPos(selection.first, e); setSelectionPos(selection.first, e);
if (selectionInterval != null) if (selectionInterval != null)
...@@ -1357,6 +1380,11 @@ ...@@ -1357,6 +1380,11 @@
} }
function onSelectionMouseUp(e) { function onSelectionMouseUp(e) {
if ($.browser == "msie") {
document.onselectstart = workarounds.onselectstart;
document.ondrag = workarounds.ondrag;
}
if (selectionInterval != null) { if (selectionInterval != null) {
clearInterval(selectionInterval); clearInterval(selectionInterval);
selectionInterval = null; selectionInterval = null;
......
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