Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Corrected scrolling behaviour of TabBar, fixed oversight in IHover in…

…terface.
  • Loading branch information...
commit 7fd09ef7dd2a4a26f39dd71015d353432e0c2cf6 1 parent 72fb7fc
@skyboy authored
Showing with 11 additions and 6 deletions.
  1. +9 −4 skyboy/components/TabBar.as
  2. +2 −2 skyboy/interfaces/tabbar/IHover.as
View
13 skyboy/components/TabBar.as
@@ -46,13 +46,16 @@ package skyboy.components {
}
addEventListener(MouseEvent.CLICK, onClick);
addEventListener(MouseEvent.MOUSE_WHEEL, onScroll);
+ cap.addEventListener(MouseEvent.MOUSE_WHEEL, onScroll);
addEventListener(MouseEvent.MOUSE_MOVE, onMove);
scrollTimer.addEventListener(TimerEvent.TIMER, tick);
if (w != w) w = 150;
width = w;
+ cap.width = w;
w = Math.max(lSB.height, tC.height, nTB.height, rSB.height)
if (w != w) w = 20;
height = w;
+ cap.height = w;
lSB.disable();
rSB.disable();
addTab(tab);
@@ -84,9 +87,9 @@ package skyboy.components {
super.scrollRect = a;
}
protected function onMove(e:MouseEvent):void {
- var items:Array = getObjectsUnderPoint(new Point(mouseX, mouseY));
+ var items:Array = getObjectsUnderPoint(new Point(e.stageX, e.stageY));
var len:int = items.length - 1;
- if (!len) return;
+ if (len < 1) return;
var over:IHover;
while (!over && len--) over = items[len] as IHover;
if (hovering) hovering.hover(false);
@@ -96,15 +99,17 @@ package skyboy.components {
protected function onScroll(e:MouseEvent):void {
var s:int = -e.delta;
e.preventDefault();
+ e.stopPropagation();
+ e.stopImmediatePropagation();
scrollCapture.scrollV = 72;
var end:Number = sRect.x + (scrollSpeed * s);
if (s > 0) end += sRect.width;
scrollTo(end);
}
protected function onClick(e:MouseEvent):void {
- var items:Array = getObjectsUnderPoint(new Point(mouseX, mouseY));
+ var items:Array = getObjectsUnderPoint(new Point(e.stageX, e.stageY));
var len:int = items.length - 1;
- if (!len) return;
+ if (len < 1) return;
var button:IButton = items[0] as IButton;
var tab:ITab;
if (button) {
View
4 skyboy/interfaces/tabbar/IHover.as
@@ -1,9 +1,9 @@
-package {
+package skyboy.interfaces.tabbar {
/**
* ...
* @author skyboy
*/
public interface IHover {
- public function hover(over:Boolean):void;
+ function hover(over:Boolean):void;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.