From b95504b32ea2237e92a80e06330806f6fd46d926 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 25 Mar 2010 11:49:37 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=84=E3=83=BC=E3=83=AB=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E7=AF=84=E5=9B=B2=E3=81=A8=E3=82=BF=E3=83=96=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=81=AE=E7=AF=84=E5=9B=B2=E3=82=92=E3=81=8D=E3=81=A1?= =?UTF-8?q?=E3=82=93=E3=81=A8=E5=88=A4=E5=88=A5=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6449 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 37 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index c6a5d967..d4055a31 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -796,26 +796,35 @@ catch(e) { var sv = b.treeStyleTab; var dt = aEvent.dataTransfer; + sv.clearDropPosition(); + if (dt.mozUserCancelled || dt.dropEffect != 'none') return; // prevent handling of this event by the default handler aEvent.stopPropagation(); - var eventPos = aEvent[sv.positionProp]; - var boxPos = b.boxObject[sv.positionProp]; - if (eventPos > boxPos && - eventPos < boxPos + b.boxObject[sv.sizeProp]) { - let box = tabbar.mTabstrip.boxObject; - boxPos = box[sv.invertedPositionProp] + (1.5 * box[sv.invertedSizeProp]); - if (sv.isVertical) - boxPos -= box[sv.invertedSizeProp] * 0.25; - eventPos = aEvent[sv.invertedPositionProp]; - if (eventPos < boxPos && - eventPos > b.boxObject[sv.invertedPositionProp]) { - return; - } - } + var eX = aEvent.screenX; + var eY = aEvent.screenY; + var x, y, w, h; + + // ignore drop on the toolbox + x = window.screenX; + y = window.screenY; + w = window.outerWidth; + h = document.getElementById('navigator-toolbox').boxObject.height; + if (eX > x && eX < x + w && eY > y && eY < y + h) + 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; var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); if (sv.isDraggingAllTabs(draggedTab))