oliviaramos / simile-widgets

Automatically exported from code.google.com/p/simile-widgets
0 stars 0 forks source link

TIMELINE: Patch for Double-click problems #289

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I received the following email from Xosen

From: Xosen 
Sent: Wednesday, June 10, 2009 3:11:40 AM
Subject: Re: Double-click problems in IE

Double click problem with IE happens when you double click over some
text (years, months, a title...). The timeline then gets the
coordinates from inside the div containing the text, which are too
small, so the timeline tries to go to the start.

I modified timeline-bundle.js son when the coordinates are small,
double click does nothing:

From this:
Timeline._Band.prototype._onDblClick=function(C,B,E){var
A=SimileAjax.DOM.getEventRelativeCoordinates(B,C);
var D=A.x-(this._viewLength/2-this._viewOffset);
this._autoScroll(-D);
};

To this:
Timeline._Band.prototype._onDblClick=function(C,B,E){var
A=SimileAjax.DOM.getEventRelativeCoordinates(B,C);
if(SimileAjax.Platform.browser.isIE){
if(B.offsetX > 100){
var D=A.x-(this._viewLength/2-this._viewOffset);
this._autoScroll(-D);
}}else{
var D=A.x-(this._viewLength/2-this._viewOffset);
this._autoScroll(-D);
}};

Original issue reported on code.google.com by larryklu...@gmail.com on 10 Jun 2009 at 2:48

GoogleCodeExporter commented 8 years ago
Thanks Larry for passing this on! Rather than patch timeline-bundle.js, I 
overrode
Timeline._Band.prototype._onDblClick in my own code, and expanded Xosen's code 
so I
could read and understand it, thus: 

Timeline._Band.prototype._onDblClick = function(innerFrame, evt, target){
  var coords = SimileAjax.DOM.getEventRelativeCoordinates(evt, innerFrame);
  if(SimileAjax.Platform.browser.isIE){
    if(evt.offsetX > 100){
      var distance = coords.x-(this._viewLength/2-this._viewOffset);
      this._autoScroll(-distance);
  }} else {
    var distance = coords.x-(this._viewLength/2-this._viewOffset);
    this._autoScroll(-distance);
}};

I find it odd that there's so little complaint of this bug. Thanks Xosen for 
working
out this hack. I hope it makes it into trunk eventually.

Original comment by crumpj...@gmail.com on 3 May 2010 at 9:02