]> ruin.nu Git - moosique.git/commitdiff
Fixed the note element length.
authorEinar Pehrson <einarp@itstud.chalmers.se>
Tue, 13 May 2003 00:27:34 +0000 (00:27 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Tue, 13 May 2003 00:27:34 +0000 (00:27 +0000)
MooNote.java
MooTrackView.java

index 3e66dab1c4aa10bf2d23674bd84b1940b1502f6b..2774c3052090a98bfadfc76a6156aba485189e6e 100644 (file)
@@ -134,7 +134,7 @@ public class MooNote extends MidiEvent {
         */
        public int getDuration() {
                if (!hasNoteOffEvent()) return 0;
-               return (int)(getTick() - noteOffEvent.getTick());
+               return (int)(noteOffEvent.getTick() - getTick());
        }
 
        /** 
index 5efb00238f5366180076fcc8b65a48d83b431a70..dbbcc9217096982b4fb862de37fab6ae8660c836 100644 (file)
@@ -93,8 +93,8 @@ public class MooTrackView extends JPanel implements ActionListener {
                                        // Moves the note element to the appropriate place.
                                        x = insets.left;
                                        y = insets.top + (int)(mn.getTick() / 24) * NOTE_HEIGHT;
-                                       height = NOTE_HEIGHT;
-                                       // height = (mn.getDuration() / 24) * NOTE_HEIGHT;
+                                       height = (mn.getDuration() / 24) * NOTE_HEIGHT;
+                                       if (height == 0) height = NOTE_HEIGHT;
                                        Rectangle r = new Rectangle(x, y, NOTE_WIDTH, height);
                                        while(isOccupied(r)) r.translate(NOTE_WIDTH, 0);
                                        elem.setBounds(r);