mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-345293 Tool window stripes are not scaled on zoom if 'Show tool window names' option is on
GitOrigin-RevId: f93cbb3d84c5742430bb3ca0bafec3c049131f2d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
107695947f
commit
54cd8e5713
@@ -42,6 +42,7 @@ class ResizeStripeManager(private val myComponent: ToolWindowToolbar) : Splittab
|
||||
private var myCalculateDelta = false
|
||||
private var myDelta = 0
|
||||
private var myCustomWidth = 0
|
||||
private var myCurrentScale = 0f
|
||||
|
||||
init {
|
||||
myComponent.addMouseListener(object : PopupHandler() {
|
||||
@@ -89,6 +90,7 @@ class ResizeStripeManager(private val myComponent: ToolWindowToolbar) : Splittab
|
||||
val enabled = isShowNames()
|
||||
if (enabled) {
|
||||
myCustomWidth = getSideCustomWidth(myComponent.anchor)
|
||||
myCurrentScale = UISettings.getInstance().currentIdeScale
|
||||
myComponent.add(mySplitter)
|
||||
}
|
||||
else {
|
||||
@@ -102,11 +104,11 @@ class ResizeStripeManager(private val myComponent: ToolWindowToolbar) : Splittab
|
||||
}
|
||||
else {
|
||||
myCustomWidth = getSideCustomWidth(myComponent.anchor)
|
||||
myCurrentScale = UISettings.getInstance().currentIdeScale
|
||||
}
|
||||
updateView()
|
||||
}
|
||||
|
||||
|
||||
override fun setProportion(proportion: Float) {
|
||||
if (myIgnoreProportion) {
|
||||
return
|
||||
@@ -124,18 +126,43 @@ class ResizeStripeManager(private val myComponent: ToolWindowToolbar) : Splittab
|
||||
}
|
||||
width += myDelta
|
||||
|
||||
val min = JBUI.scale(if (UISettings.Companion.getInstance().compactMode) 32 else 40)
|
||||
width = checkMinMax(width)
|
||||
|
||||
myCustomWidth = width
|
||||
myCurrentScale = UISettings.getInstance().currentIdeScale
|
||||
setSideCustomWidth(myComponent, width)
|
||||
updateView()
|
||||
}
|
||||
|
||||
private fun checkMinMax(width: Int): Int {
|
||||
val min = JBUI.scale(if (UISettings.getInstance().compactMode) 32 else 40)
|
||||
if (width < min) {
|
||||
width = min
|
||||
return min
|
||||
}
|
||||
|
||||
val max = JBUI.scale(100)
|
||||
if (width > max) {
|
||||
width = max
|
||||
return max
|
||||
}
|
||||
|
||||
myCustomWidth = width
|
||||
setSideCustomWidth(myComponent, width)
|
||||
return width
|
||||
}
|
||||
|
||||
fun updateNamedState() {
|
||||
val currentScale = UISettings.getInstance().currentIdeScale
|
||||
if (myCustomWidth == 0 && myCurrentScale == 0f) {
|
||||
myCustomWidth = getSideCustomWidth(myComponent.anchor)
|
||||
val width = checkMinMax(myCustomWidth)
|
||||
if (width != myCustomWidth) {
|
||||
myCustomWidth = width
|
||||
setSideCustomWidth(myComponent, width)
|
||||
}
|
||||
}
|
||||
else if (myCurrentScale != currentScale) {
|
||||
myCustomWidth = (myCustomWidth * currentScale / myCurrentScale).toInt()
|
||||
setSideCustomWidth(myComponent, myCustomWidth)
|
||||
}
|
||||
myCurrentScale = currentScale
|
||||
updateView()
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ internal class ToolWindowPaneNewButtonManager(paneId: String, isPrimary: Boolean
|
||||
val visible = showButtons || state.isStripesOverlaid
|
||||
left.isVisible = visible
|
||||
right.isVisible = visible
|
||||
left.updateNamedState()
|
||||
right.updateNamedState()
|
||||
return oldSquareVisible != visible
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,12 @@ abstract class ToolWindowToolbar(private val isPrimary: Boolean, val anchor: Too
|
||||
myResizeManager.updateState(toolbar)
|
||||
}
|
||||
|
||||
fun updateNamedState() {
|
||||
if (isVisible && ResizeStripeManager.isShowNames()) {
|
||||
myResizeManager.updateNamedState()
|
||||
}
|
||||
}
|
||||
|
||||
open fun createBorder():Border = JBUI.Borders.empty()
|
||||
open fun getBorderColor(): Color? = JBUI.CurrentTheme.ToolWindow.borderColor()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user