mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
feat: external release to create a new window (#162)
This commit is contained in:
@@ -75,6 +75,7 @@ class MyTabbedPane : FlatTabbedPane() {
|
|||||||
private var terminalTab: TerminalTab? = null
|
private var terminalTab: TerminalTab? = null
|
||||||
private var isDragging = false
|
private var isDragging = false
|
||||||
private var lastVisitTabIndex = -1
|
private var lastVisitTabIndex = -1
|
||||||
|
private var releasedPoint = Point()
|
||||||
|
|
||||||
override fun mousePressed(e: MouseEvent) {
|
override fun mousePressed(e: MouseEvent) {
|
||||||
val index = indexAtLocation(e.x, e.y)
|
val index = indexAtLocation(e.x, e.y)
|
||||||
@@ -137,8 +138,15 @@ class MyTabbedPane : FlatTabbedPane() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 如果是取消,那么不需要移动到其它窗口
|
// 如果是取消,那么不需要移动到其它窗口
|
||||||
val c = if (cancelled) null else getTopMostWindowUnderMouse()
|
val c = if (cancelled) owner else getTopMostWindowUnderMouse()
|
||||||
if (c != owner && c is TermoraFrame) {
|
|
||||||
|
// 如果等于 null 表示在空地方释放,那么单独一个窗口
|
||||||
|
if (c == null) {
|
||||||
|
val window = TermoraFrameManager.getInstance().createWindow()
|
||||||
|
dragToAnotherWindow(window)
|
||||||
|
window.location = releasedPoint
|
||||||
|
window.isVisible = true
|
||||||
|
} else if (c != owner && c is TermoraFrame) { // 如果在某个窗口内释放,那么就移动到某个窗口内
|
||||||
dragToAnotherWindow(c)
|
dragToAnotherWindow(c)
|
||||||
} else {
|
} else {
|
||||||
val tab = this.terminalTab
|
val tab = this.terminalTab
|
||||||
@@ -161,6 +169,7 @@ class MyTabbedPane : FlatTabbedPane() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun mouseReleased(e: MouseEvent) {
|
override fun mouseReleased(e: MouseEvent) {
|
||||||
|
releasedPoint = e.point
|
||||||
stopDrag()
|
stopDrag()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user