ツールバーの範囲とタブバーの範囲をきちんと判別するようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6449 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-25 11:49:37 +00:00
parent 8f24aa98c6
commit b95504b32e

View File

@ -796,26 +796,35 @@ catch(e) {
var sv = b.treeStyleTab; var sv = b.treeStyleTab;
var dt = aEvent.dataTransfer; var dt = aEvent.dataTransfer;
sv.clearDropPosition();
if (dt.mozUserCancelled || dt.dropEffect != 'none') if (dt.mozUserCancelled || dt.dropEffect != 'none')
return; return;
// prevent handling of this event by the default handler // prevent handling of this event by the default handler
aEvent.stopPropagation(); aEvent.stopPropagation();
var eventPos = aEvent[sv.positionProp]; var eX = aEvent.screenX;
var boxPos = b.boxObject[sv.positionProp]; var eY = aEvent.screenY;
if (eventPos > boxPos && var x, y, w, h;
eventPos < boxPos + b.boxObject[sv.sizeProp]) {
let box = tabbar.mTabstrip.boxObject; // ignore drop on the toolbox
boxPos = box[sv.invertedPositionProp] + (1.5 * box[sv.invertedSizeProp]); x = window.screenX;
if (sv.isVertical) y = window.screenY;
boxPos -= box[sv.invertedSizeProp] * 0.25; w = window.outerWidth;
eventPos = aEvent[sv.invertedPositionProp]; h = document.getElementById('navigator-toolbox').boxObject.height;
if (eventPos < boxPos && if (eX > x && eX < x + w && eY > y && eY < y + h)
eventPos > b.boxObject[sv.invertedPositionProp]) { return;
// ignore drop near the tab bar
var box = tabbar.boxObject;
var ignoreArea = Math.max(16, parseInt(tabbar.firstChild.boxObject.height / 2));
x = box.screenX - (sv.isVertical ? ignoreArea : 0 );
y = box.screenY - ignoreArea;
w = box.width + (sv.isVertical ? ignoreArea + ignoreArea : 0 );
h = box.height + ignoreArea + ignoreArea;
if (eX > x && eX < x + w && eY > y && eY < y + h)
return; return;
}
}
var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0);
if (sv.isDraggingAllTabs(draggedTab)) if (sv.isDraggingAllTabs(draggedTab))