mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-235385 Tab is not detached when crossing the IDEA frame
GitOrigin-RevId: dae635a8c777ee09461ac96d888ae635e1b0bdd1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c22f51bb05
commit
90da73fb35
+5
-1
@@ -84,6 +84,8 @@ public abstract class SingleRowLayoutStrategy {
|
||||
|
||||
@Override
|
||||
public boolean isDragOut(TabLabel tabLabel, int deltaX, int deltaY) {
|
||||
Rectangle bounds = tabLabel.getBounds();
|
||||
if (bounds.x + bounds.width + deltaX < 0 || bounds.x + bounds.width > tabLabel.getParent().getWidth()) return true;
|
||||
return Math.abs(deltaY) > tabLabel.getHeight() * TabLayout.getDragOutMultiplier();
|
||||
}
|
||||
|
||||
@@ -257,7 +259,9 @@ public abstract class SingleRowLayoutStrategy {
|
||||
|
||||
@Override
|
||||
public boolean isDragOut(TabLabel tabLabel, int deltaX, int deltaY) {
|
||||
return Math.abs(deltaX) > tabLabel.getHeight() * TabLayout.getDragOutMultiplier();
|
||||
Rectangle bounds = tabLabel.getBounds();
|
||||
if (bounds.y + bounds.height + deltaX < 0 || bounds.y + bounds.height > tabLabel.getParent().getHeight()) return true;
|
||||
return Math.abs(deltaX) > tabLabel.getWidth() * TabLayout.getDragOutMultiplier();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,10 +16,7 @@ import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.impl.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.FrameWrapper;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.BusyObject;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.*;
|
||||
import com.intellij.openapi.wm.ex.WindowManagerEx;
|
||||
@@ -214,6 +211,7 @@ public final class DockManagerImpl extends DockManager implements PersistentStat
|
||||
|
||||
private final @NotNull DockableContent myContent;
|
||||
|
||||
private DockContainer myStartDragContainer;
|
||||
private DockContainer myCurrentOverContainer;
|
||||
private final JLabel myImageContainer;
|
||||
|
||||
@@ -221,6 +219,7 @@ public final class DockManagerImpl extends DockManager implements PersistentStat
|
||||
myWindow = new JDialog(WindowManager.getInstance().getFrame(myProject));
|
||||
myWindow.setUndecorated(true);
|
||||
myContent = content;
|
||||
myStartDragContainer = getContainerFor(me.getComponent());
|
||||
|
||||
Image previewImage = content.getPreviewImage();
|
||||
|
||||
@@ -343,21 +342,26 @@ public final class DockManagerImpl extends DockManager implements PersistentStat
|
||||
}
|
||||
|
||||
private @Nullable DockContainer findContainerFor(RelativePoint point, @NotNull DockableContent<?> content) {
|
||||
for (DockContainer each : getAllContainers()) {
|
||||
DockContainer candidate = null;
|
||||
for (DockContainer each : myContainers) {
|
||||
RelativeRectangle rec = each.getAcceptArea();
|
||||
if (rec.contains(point) && each.getContentResponse(content, point).canAccept()) {
|
||||
return each;
|
||||
if (candidate == null || Comparing.equal(candidate, myCurrentDragSession.myStartDragContainer)) {
|
||||
candidate = each;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (DockContainer each : getAllContainers()) {
|
||||
for (DockContainer each : myContainers) {
|
||||
RelativeRectangle rec = each.getAcceptAreaFallback();
|
||||
if (rec.contains(point) && each.getContentResponse(content, point).canAccept()) {
|
||||
return each;
|
||||
if (candidate == null || Comparing.equal(candidate, myCurrentDragSession.myStartDragContainer)) {
|
||||
candidate = each;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return candidate;
|
||||
}
|
||||
|
||||
private DockContainerFactory getFactory(String type) {
|
||||
@@ -468,6 +472,7 @@ public final class DockManagerImpl extends DockManager implements PersistentStat
|
||||
getReady().doWhenDone(() -> {
|
||||
if (myContainer.isEmpty()) {
|
||||
close();
|
||||
myContainers.remove(myContainer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+6
-1
@@ -5,6 +5,7 @@ import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.ui.tabs.impl.LayoutPassInfo;
|
||||
import com.intellij.ui.tabs.impl.ShapeTransform;
|
||||
import com.intellij.ui.tabs.impl.TabLabel;
|
||||
import com.intellij.ui.tabs.impl.TabLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -86,6 +87,8 @@ public abstract class SingleRowLayoutStrategy {
|
||||
|
||||
@Override
|
||||
public boolean isDragOut(TabLabel tabLabel, int deltaX, int deltaY) {
|
||||
Rectangle bounds = tabLabel.getBounds();
|
||||
if (bounds.x + bounds.width + deltaX < 0 || bounds.x + bounds.width > tabLabel.getParent().getWidth()) return true;
|
||||
return Math.abs(deltaY) > tabLabel.getHeight() * myLayout.getDragOutMultiplier();
|
||||
}
|
||||
|
||||
@@ -326,7 +329,9 @@ public abstract class SingleRowLayoutStrategy {
|
||||
|
||||
@Override
|
||||
public boolean isDragOut(TabLabel tabLabel, int deltaX, int deltaY) {
|
||||
return Math.abs(deltaX) > tabLabel.getHeight() * myLayout.getDragOutMultiplier();
|
||||
Rectangle bounds = tabLabel.getBounds();
|
||||
if (bounds.y + bounds.height + deltaX < 0 || bounds.y + bounds.height > tabLabel.getParent().getHeight()) return true;
|
||||
return Math.abs(deltaX) > tabLabel.getWidth() * TabLayout.getDragOutMultiplier();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user