Changeset 1517 for trunk


Ignore:
Timestamp:
03/10/20 16:03:37 (4 years ago)
Author:
bnemhaus
Message:

Fixed an issue where Apollo PLACE gesture was causing creating polylines not to work.

Explanation: It used to be that Apollo would get first go at interpreting mouse/keyboard actions and would then optionally pass off to Expeditee. This was changed with the new GIO rework for both base Expeditee and Apollo getting to run their gestures. In this scenario, Expeditee was getting it's go at performing PLACE, and actually doing polylines correctly, but then Apollo was getting it's go and clearing the FreeItems list (which contained the new part of the polyline).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/apollo/ApolloGestureActions.java

    r1415 r1517  
    11package org.apollo;
    22
     3import java.util.ArrayList;
    34import java.util.Collection;
    45import java.util.HashMap;
     
    210211                                new GestureAction() {                           
    211212                                       
    212                                         final List<SampledTrack> sampledTracks = new LinkedList<SampledTrack>();
     213                                        final List<SampledTrack> sampledTracksOnFreeItems = new ArrayList<SampledTrack>();
    213214                       
    214215                                        @Override
     
    223224                                                                final SampledTrack st = (SampledTrack) w;
    224225                                                                st.setIgnoreInjection(true);
    225                                                                 sampledTracks.add(st);
     226                                                                sampledTracksOnFreeItems.add(st);
    226227                                                        }
    227228                                                });
     
    229230                                                 
    230231                                        @Override
    231                                         public void exec(final Gesture gesture) {
     232                                        public void exec(final Gesture gesture) {                                               
    232233                                                final PickUpGestureData data = (PickUpGestureData) gesture.getData();
    233234                                                final List<Item> widgetPieces = new LinkedList<Item>();
    234235                                                if (data.getCopy()) {
    235                                                         sampledTracks.forEach(st -> {
     236                                                        sampledTracksOnFreeItems.forEach(st -> {
    236237                                                                st.getItems().forEach(i -> {
    237238                                                                        StandardGestureActions.anchor(i);
     
    239240                                                                });
    240241                                                        });
    241                                                         FreeItems.getInstance().clear();
     242                                                        //FreeItems.getInstance().clear();
     243                                                        FreeItems.getInstance().removeAll(widgetPieces);
    242244                                                        anchorTracks(widgetPieces);
    243245                                                        final List<Item> toPickup = new LinkedList<Item>();
    244                                                         sampledTracks.forEach(st -> {
     246                                                        sampledTracksOnFreeItems.forEach(st -> {
    245247                                                                try {
    246248                                                                        final Widget copy = st.copy();
     
    260262                                        @Override
    261263                                        public void finalise(final Gesture gesture) {
    262                                                 sampledTracks.forEach(st -> st.setIgnoreInjection(false));
    263                                                 sampledTracks.clear();
     264                                                sampledTracksOnFreeItems.forEach(st -> st.setIgnoreInjection(false));
     265                                                sampledTracksOnFreeItems.clear();
    264266                                        }
    265267                                });
Note: See TracChangeset for help on using the changeset viewer.