Fixed cursor flickering on dragging in tag list

This commit is contained in:
Jindra Petřík
2022-11-09 22:55:09 +01:00
parent 04463b6ffc
commit 1daea39dab

View File

@@ -1153,7 +1153,9 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
cursor = selectCursor;
}
setCursor(cursor);
if (getCursor() != cursor) {
setCursor(cursor);
}
mode = newMode;
}
}
@@ -2359,12 +2361,16 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
debugLabel.setText(ret.toString());
}
if (freeTransformDepth == -1) {
Cursor newCursor;
if (handCursor) {
iconPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
newCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
} else if (iconPanel.hasAllowMove()) {
iconPanel.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
newCursor = Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR);
} else {
iconPanel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
newCursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
}
if (iconPanel.getCursor() != newCursor) { //call setcursor only when needed to avoid cursor flickering when dragging in the tree
iconPanel.setCursor(newCursor);
}
}
}