|
|
@ -1,7 +1,5 @@ |
|
|
|
package com.fr.design.gui.icontainer; |
|
|
|
package com.fr.design.gui.icontainer; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.svg.SVGLoader; |
|
|
|
|
|
|
|
import com.fr.base.svg.SystemScaleUtils; |
|
|
|
|
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
@ -29,8 +27,6 @@ import java.awt.event.MouseMotionListener; |
|
|
|
public class UIResizableContainer extends JPanel { |
|
|
|
public class UIResizableContainer extends JPanel { |
|
|
|
private static final long serialVersionUID = 1854340560790476907L; |
|
|
|
private static final long serialVersionUID = 1854340560790476907L; |
|
|
|
private static final int MAX_PARA_HEIGHT = 240; |
|
|
|
private static final int MAX_PARA_HEIGHT = 240; |
|
|
|
private final boolean HI_DPI_SUPPORT = SystemScaleUtils.isJreHiDPIEnabled(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int containerWidth = 240; |
|
|
|
private int containerWidth = 240; |
|
|
|
private int preferredWidth = 240; |
|
|
|
private int preferredWidth = 240; |
|
|
|
private int toolPaneY = 300; |
|
|
|
private int toolPaneY = 300; |
|
|
@ -428,12 +424,9 @@ public class UIResizableContainer extends JPanel { |
|
|
|
g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, getWidth(), getHeight(), null); |
|
|
|
g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, getWidth(), getHeight(), null); |
|
|
|
SvgPaintUtils.beforePaint((Graphics2D) g); |
|
|
|
SvgPaintUtils.beforePaint((Graphics2D) g); |
|
|
|
//如果环境支持高清化,在调整缩放比例时绘制svg会影响到位置的变化,若图标无确定裁剪位置,则需要进行调整
|
|
|
|
//如果环境支持高清化,在调整缩放比例时绘制svg会影响到位置的变化,若图标无确定裁剪位置,则需要进行调整
|
|
|
|
int dragLineX = HI_DPI_SUPPORT ? (int) ((getWidth() - toolPaneHeight) / 2 * SVGLoader.SYSTEM_SCALE) : (getWidth() - toolPaneHeight) / 2; |
|
|
|
g.drawImage(UIConstants.DRAG_LINE, SvgPaintUtils.calculatePositionX((getWidth() - toolPaneHeight) / 2), SvgPaintUtils.calculatePositionY(3), null); |
|
|
|
int dragLineY = HI_DPI_SUPPORT ? (int) (3 * SVGLoader.SYSTEM_SCALE) : 3; |
|
|
|
|
|
|
|
int downButtonX = HI_DPI_SUPPORT ? (int) ((getWidth() - toolPaneHeight - ARROW_MARGIN) * SVGLoader.SYSTEM_SCALE) : (getWidth() - toolPaneHeight - ARROW_MARGIN); |
|
|
|
|
|
|
|
g.drawImage(UIConstants.DRAG_LINE, dragLineX, dragLineY, null); |
|
|
|
|
|
|
|
g.drawImage(upButton, ARROW_MARGIN, 0, null); |
|
|
|
g.drawImage(upButton, ARROW_MARGIN, 0, null); |
|
|
|
g.drawImage(downButton, downButtonX, 0, null); |
|
|
|
g.drawImage(downButton, SvgPaintUtils.calculatePositionX(getWidth() - toolPaneHeight - ARROW_MARGIN), 0, null); |
|
|
|
SvgPaintUtils.afterPaint((Graphics2D) g); |
|
|
|
SvgPaintUtils.afterPaint((Graphics2D) g); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -533,9 +526,7 @@ public class UIResizableContainer extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
SvgPaintUtils.beforePaint((Graphics2D) g); |
|
|
|
SvgPaintUtils.beforePaint((Graphics2D) g); |
|
|
|
//如果环境支持高清化,在调整缩放比例时绘制svg会影响到位置的变化,若图标无确定裁剪位置,则需要进行调整
|
|
|
|
//如果环境支持高清化,在调整缩放比例时绘制svg会影响到位置的变化,若图标无确定裁剪位置,则需要进行调整
|
|
|
|
int x = HI_DPI_SUPPORT ? (int) (-6 * SVGLoader.SYSTEM_SCALE) : -6; |
|
|
|
g.drawImage(button, SvgPaintUtils.calculatePositionX(-6), SvgPaintUtils.calculatePositionY(ARROW_MARGIN_VERTICAL), this); |
|
|
|
int y = HI_DPI_SUPPORT ? (int) (ARROW_MARGIN_VERTICAL * SVGLoader.SYSTEM_SCALE) : ARROW_MARGIN_VERTICAL; |
|
|
|
|
|
|
|
g.drawImage(button, x, y, this); |
|
|
|
|
|
|
|
SvgPaintUtils.afterPaint((Graphics2D) g); |
|
|
|
SvgPaintUtils.afterPaint((Graphics2D) g); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null); |
|
|
|
g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null); |
|
|
@ -552,8 +543,7 @@ public class UIResizableContainer extends JPanel { |
|
|
|
button = UIConstants.DRAG_RIGHT_PRESS; |
|
|
|
button = UIConstants.DRAG_RIGHT_PRESS; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int x = HI_DPI_SUPPORT ? (int) (10 * SVGLoader.SYSTEM_SCALE) : 10; |
|
|
|
g.drawImage(button, SvgPaintUtils.calculatePositionX(10), ARROW_MARGIN_VERTICAL, this); |
|
|
|
g.drawImage(button, x, ARROW_MARGIN_VERTICAL, this); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (isLeftRightDragEnabled) { |
|
|
|
if (isLeftRightDragEnabled) { |
|
|
|
g.drawImage(UIConstants.DRAG_DOT_VERTICAL, 2, getHeight() / 2, 5, toolPaneHeight, null); |
|
|
|
g.drawImage(UIConstants.DRAG_DOT_VERTICAL, 2, getHeight() / 2, 5, toolPaneHeight, null); |
|
|
|