shrink sensitive area based on the size of clickable element

This commit is contained in:
SHIMODA Hiroshi 2011-12-19 17:29:37 +09:00
parent 6a9f32235c
commit d447107fbe

View File

@ -406,11 +406,12 @@ AutoHideBrowser.prototype = {
var sensitiveArea = this.sensitiveArea; var sensitiveArea = this.sensitiveArea;
if (this.shrunken) { if (this.shrunken) {
let clickable;
if (this.widthFromMode > 24 && if (this.widthFromMode > 24 &&
this.isNearClickable(aEvent)) { (clickable = this.getNearestClickableBox(aEvent))) {
/* For resizing of shrunken tab bar and clicking closeboxes, /* For resizing of shrunken tab bar and clicking closeboxes,
we have to shrink sensitive area. */ we have to shrink sensitive area. */
sensitiveArea = -24; sensitiveArea = -(clickable.width + clickable.padding);
} }
else if (this.resizer) else if (this.resizer)
sensitiveArea = -this.resizer.boxObject.width; sensitiveArea = -this.resizer.boxObject.width;
@ -464,12 +465,12 @@ AutoHideBrowser.prototype = {
MOUSE_POSITION_INSIDE : (1 << 1), MOUSE_POSITION_INSIDE : (1 << 1),
MOUSE_POSITION_NEAR : (1 << 2), MOUSE_POSITION_NEAR : (1 << 2),
MOUSE_POSITION_SENSITIVE : (1 << 1) | (1 << 2), MOUSE_POSITION_SENSITIVE : (1 << 1) | (1 << 2),
isNearClickable : function AHB_isNearClickable(aEvent) getNearestClickableBox : function AHB_getNearestClickableBox(aEvent)
{ {
var sv = this.treeStyleTab; var sv = this.treeStyleTab;
var tab = sv.getTabFromCoordinate(aEvent[sv.screenPositionProp]); var tab = sv.getTabFromCoordinate(aEvent[sv.screenPositionProp]);
if (!tab) if (!tab)
return false; return null;
var position = sv.invertedScreenPositionProp; var position = sv.invertedScreenPositionProp;
var size = sv.invertedSizeProp; var size = sv.invertedSizeProp;
@ -488,7 +489,10 @@ AutoHideBrowser.prototype = {
); );
if (closebox[position] - padding <= coordinate && if (closebox[position] - padding <= coordinate &&
closebox[position] + closebox[size] + padding >= coordinate) closebox[position] + closebox[size] + padding >= coordinate)
return true; return {
padding : padding,
__proto__ : closebox
};
} }
var twisty; var twisty;
@ -502,10 +506,13 @@ AutoHideBrowser.prototype = {
); );
if (twisty[position] - padding <= coordinate && if (twisty[position] - padding <= coordinate &&
twisty[position] + twisty[size] + padding >= coordinate) twisty[position] + twisty[size] + padding >= coordinate)
return true; return {
padding : padding,
__proto__ : twisty
};
} }
return false; return null;
}, },
cancelShowHideOnMouseMove : function AHB_cancelShowHideOnMouseMove() cancelShowHideOnMouseMove : function AHB_cancelShowHideOnMouseMove()