mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[ui] fix html icon position
GitOrigin-RevId: 983d62673e811199d31a01d2de57fa680e05346c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
250eae64c8
commit
98afd99b0a
@@ -3,6 +3,7 @@ package com.intellij.util.ui
|
||||
|
||||
import com.intellij.openapi.diagnostic.thisLogger
|
||||
import com.intellij.openapi.util.IconLoader
|
||||
import com.intellij.ui.scale.JBUIScale
|
||||
import java.awt.*
|
||||
import java.awt.image.BufferedImage
|
||||
import java.io.ByteArrayInputStream
|
||||
@@ -129,6 +130,12 @@ internal constructor(private val extensions: List<(Element, View) -> View?>,
|
||||
}
|
||||
}
|
||||
|
||||
override fun getAlignment(axis: Int): Float {
|
||||
// 12 is a "standard" font height which has user scale of 1
|
||||
if (axis == Y_AXIS) return JBUIScale.scale(12) / icon.iconHeight.toFloat()
|
||||
return super.getAlignment(axis)
|
||||
}
|
||||
|
||||
override fun getToolTipText(x: Float, y: Float, allocation: Shape): String? {
|
||||
return element.attributes.getAttribute(HTML.Attribute.ALT) as? String
|
||||
}
|
||||
@@ -137,7 +144,7 @@ internal constructor(private val extensions: List<(Element, View) -> View?>,
|
||||
val g2d = g as Graphics2D
|
||||
val savedComposite = g2d.composite
|
||||
g2d.composite = AlphaComposite.SrcOver // support transparency
|
||||
icon.paintIcon(null, g, allocation.bounds.x, allocation.bounds.y - 4)
|
||||
icon.paintIcon(null, g, allocation.bounds.x, allocation.bounds.y)
|
||||
g2d.composite = savedComposite
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user