[Prototype-core] Re: isLeftClick Bug in Proto 1.6.0 RC1

2007-10-18 Thread Richard Quadling

On 17/10/2007, Bart Lewis <[EMAIL PROTECTED]> wrote:
>
> Today I updated to Prototype 1.6.0 RC1 from RC0. I am also using
> Scriptaculous 1.8 preview.
>
> Beyond changing my "contentloaded" to "dom:loaded" the transition
> seemed to go fairly smoothly. Until I encountered the following error
> in IE (6 and 7):
>
> Drags created with "new Draggable(...)" no longer drag.
>
> I traced this back to prototype's "isLeftClick" always returning
> false.
>
> Looks like isLeftClick was significantly changed just yesterday:
> http://dev.rubyonrails.org/changeset/7926
>
> -B

Yes it was. Here is the new code you need for the
is[Left|Middle|Right]Click to work.

Around line 3700-ish.

Event.Methods = (function() {
  var isButton;

  if (Prototype.Browser.IE) {
var buttonMap = { 0: 1, 1: 4, 2: 2 };
isButton = function(event, code) {
  return event.button == buttonMap[code];
};

  } else if (Prototype.Browser.WebKit) {
isButton = function(event, code) {
  switch (code) {
case 0: return event.which == 1 && !event.metaKey;
case 1: return event.which == 1 && event.metaKey;
default: return false;
  }
};

  } else {
isButton = function(event, code) {
  return event.which ? (event.which === code + 1) : (event.button === code);
};
  }
  return {
isLeftClick:   function(event) { return isButton(event, 0) },
isMiddleClick: function(event) { return isButton(event, 1) },
isRightClick:  function(event) { return isButton(event, 2) },

...

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: isLeftClick Bug in Proto 1.6.0 RC1

2007-10-17 Thread Mislav Marohnić
On 10/17/07, Bart Lewis <[EMAIL PROTECTED]> wrote:
>
>
> Looks like isLeftClick was significantly changed just yesterday:
> http://dev.rubyonrails.org/changeset/7926


... and it was fixed today: http://dev.rubyonrails.org/changeset/7954

Thanks for reporting, though. Everyone who has troubles with this should
upgrade to latest trunk.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---