From fbd5c6668283ae022168059c8d46a261aa08d501 Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 20 Jul 2020 19:20:34 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-34907=20linux=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?-=E7=BA=B8=E5=BC=A0=E8=83=8C=E6=99=AF-=E6=B8=90=E5=8F=98?= =?UTF-8?q?=E8=89=B2=EF=BC=8C=E5=8F=B3=E8=BE=B9=E7=9A=84=E6=B8=B8=E6=A0=87?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=8B=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/style/background/gradient/GradientBar.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java index efeffa4e49..46d1b9165b 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java @@ -11,6 +11,7 @@ import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectable; import com.fr.stable.AssistUtils; +import com.fr.stable.os.OperatingSystem; import javax.swing.JComponent; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -124,14 +125,20 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab protected void addMouseDragListener() { this.addMouseMotionListener(new MouseAdapter() { public void mouseDragged(MouseEvent e) { - + int oldIndex = index; for (int i = 0; i < list.size(); i++) { if (list.get(i).contains(e.getX(), e.getY())) { index = i; break; } } - + if(OperatingSystem.isLinux() && AssistUtils.equals(oldIndex,index)){ + if(Math.abs(p1.getX() - e.getX()) > Math.abs(p2.getX() - e.getX())){ + index = 1; + }else{ + index = 0; + } + } boolean x = e.getX() <= max && e.getX() >= min; if (x && e.getY() < MAX_VERTICAL) { list.get(index).setX(e.getX());