this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix sprite reordering freeze

clover d28ab5c2 2d184de1

+34 -20
+2 -1
CHANGELOG.md
··· 2 2 3 3 All notable changes to this project will be documented in this file. 4 4 5 - ## Next Release 5 + ## [0.9.3] - 2025-02-07 6 6 7 7 ### Added 8 8 - (Sprite Editor) Copy/paste/duplicate for commands/keyframes ··· 15 15 - (Map Editor) Fixed crash when fusing vertices 16 16 - (Map Editor) (MacOS) Fixed mouse capture when accessibility permissions are not enabled 17 17 - (Sprite Editor) Copy animation works properly 18 + - (Sprite Editor) Reordering current animation or component no longer freezes the editor
+1 -1
src/main/java/game/sprite/editor/ImageInfoPanel.java
··· 37 37 Graphics2D g2 = (Graphics2D) g; 38 38 g.drawImage(TextureManager.background, 0, 0, IMG_SIZE, IMG_SIZE, null); 39 39 40 - if (ref.asset != null) { 40 + if (ref != null && ref.asset != null) { 41 41 ref.asset.previewImg = new BufferedImage( 42 42 ref.asset.getPalette().getIndexColorModel(), 43 43 ref.asset.previewImg.getRaster(), false, null);
+8 -3
src/main/java/game/sprite/editor/SpriteEditor.java
··· 1445 1445 getOptionDialog("Edit " + sprite + " Animations", listPanel).setOptions("Done").choose(); 1446 1446 1447 1447 invokeLater(() -> { 1448 - setSprite(spriteID, false); 1449 1448 sprite.recalculateIndices(); 1450 - if (currentAnim != null && sprite.animations.contains(currentAnim)) 1451 - animationComboBox.setSelectedItem(currentAnim); 1449 + if (currentAnim != null) { 1450 + if (sprite.animations.contains(currentAnim)) 1451 + animationComboBox.setSelectedItem(currentAnim); 1452 + else if (!sprite.animations.isEmpty()) 1453 + animationComboBox.setSelectedIndex(0); 1454 + else 1455 + animationComboBox.setSelectedItem(null); 1456 + } 1452 1457 animationComboBox.repaint(); 1453 1458 }); 1454 1459 }
+23 -15
src/main/java/util/ui/ListAdapterComboboxModel.java
··· 2 2 3 3 import javax.swing.ComboBoxModel; 4 4 import javax.swing.ListModel; 5 + import javax.swing.SwingUtilities; 5 6 import javax.swing.event.EventListenerList; 6 7 import javax.swing.event.ListDataEvent; 7 8 import javax.swing.event.ListDataListener; ··· 74 75 public void addListDataListener(ListDataListener l) 75 76 { 76 77 listenerList.add(ListDataListener.class, l); 77 - 78 78 } 79 79 80 80 @Override ··· 99 99 100 100 private void checkSelection(ListDataEvent e) 101 101 { 102 - Object selectedItem = getSelectedItem(); 103 - @SuppressWarnings("unchecked") 104 - ListModel<T> listModel = (ListModel<T>) e.getSource(); 105 - int size = listModel.getSize(); 106 - boolean selectedItemNoLongerExists = true; 102 + // defer until later to avoid setting selectedObject to null during a drag reordering 103 + // event which triggers a deletion followed by an insertion 104 + SwingUtilities.invokeLater(() -> { 105 + Object selectedItem = getSelectedItem(); 106 + if (selectedItem == null) 107 + return; 107 108 108 - for (int i = 0; i < size; i++) { 109 - Object elementAt = listModel.getElementAt(i); 110 - if (elementAt != null && elementAt.equals(selectedItem)) { 111 - selectedItemNoLongerExists = false; 112 - break; 109 + @SuppressWarnings("unchecked") 110 + ListModel<T> listModel = (ListModel<T>) e.getSource(); 111 + int size = listModel.getSize(); 112 + 113 + boolean selectedItemNoLongerExists = true; 114 + 115 + for (int i = 0; i < size; i++) { 116 + Object elementAt = listModel.getElementAt(i); 117 + if (elementAt != null && elementAt.equals(selectedItem)) { 118 + selectedItemNoLongerExists = false; 119 + break; 120 + } 113 121 } 114 - } 115 122 116 - if (selectedItemNoLongerExists) { 117 - ListAdapterComboboxModel.this.selectedObject = null; 118 - } 123 + if (selectedItemNoLongerExists) { 124 + ListAdapterComboboxModel.this.selectedObject = null; 125 + } 126 + }); 119 127 } 120 128 121 129 protected void delegateListDataEvent(ListDataEvent lde)