tomws
11-25-2009, 10:26 PM
I'm confused with where this problem is coming from. Most likely I'm just ignorant of this "feature". This code is executed when clicking on an image area to generate a shape on a canvas:
mouseclick = function(e,clicked_area)
{
var area_obj = clicked_area ? clicked_area : this;
//alert('here');
if (! $('#canvas_'+$(area_obj).attr('id')).attr('id'))
{
draw(area_obj);
}
else
{
alert('del');
$('#canvas_' + $(area_obj).attr('id')).remove();
clear_canvas(canvas);
}
};
IE 6/7/8 all seem to traverse too slowly or execute too quickly... not sure what to call it. When the #canvas_foo tag is not present (and it's not until after draw()), processing still enters the else statement. However, if I slow it down with the alert('here'), the if/else operates as expected.
I can also break the expected flow by timing a spacebar hit just right so that it kills off the first alert as soon as it triggers. Something else that makes it seem like some odd speed issue.
Furthermore, I can confirm that it's not double-processing the click because an alert() placed within draw() is not triggered unless the "slow down" alert is uncommented.
What am I missing?
mouseclick = function(e,clicked_area)
{
var area_obj = clicked_area ? clicked_area : this;
//alert('here');
if (! $('#canvas_'+$(area_obj).attr('id')).attr('id'))
{
draw(area_obj);
}
else
{
alert('del');
$('#canvas_' + $(area_obj).attr('id')).remove();
clear_canvas(canvas);
}
};
IE 6/7/8 all seem to traverse too slowly or execute too quickly... not sure what to call it. When the #canvas_foo tag is not present (and it's not until after draw()), processing still enters the else statement. However, if I slow it down with the alert('here'), the if/else operates as expected.
I can also break the expected flow by timing a spacebar hit just right so that it kills off the first alert as soon as it triggers. Something else that makes it seem like some odd speed issue.
Furthermore, I can confirm that it's not double-processing the click because an alert() placed within draw() is not triggered unless the "slow down" alert is uncommented.
What am I missing?