Ticket #2441: 2441-change-location-by-hud.patch

File 2441-change-location-by-hud.patch, 2.9 KB (added by deni, 15 years ago)
  • src/main/java/org/sophie2/main/app/halos/huds/properties/PropertiesHud.java

    ### Eclipse Workspace Patch 1.0
    #P org.sophie2.main.app.halos
     
    14181418                        public boolean handle(EventR3 event) { 
    14191419                                VisualElement source = event.getSource(FrameXPosition.class); 
    14201420                                ResourceAccess access = getAccess(source); 
     1421                                LocationChannel oldChannel = MemberElement.KEY_LOCATION.get(access); 
     1422                                TimePos time = getTime(source);                          
     1423                                ImmPoint oldLocation = oldChannel.getValue(time); 
     1424                                 
    14211425                                String input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 
    14221426                                                String.class); 
    1423                                 ImmPoint location = MemberElement.KEY_LOCATION.get(access) 
    1424                                                 .getValue(getTime(source)); 
    14251427                                float value = BoundValidation.parseNumber(input, Float.class); 
    1426                                 final ImmPoint newPoint = new ImmPoint(value, location.getY()); 
    1427                                 final LocationChannel channel = MemberElement.KEY_LOCATION.get(access); 
     1428                                ImmPoint newLocation = new ImmPoint(value, oldLocation.getY()); 
     1429                                final LocationChannel newChannel = oldChannel.setValue(time, newLocation); 
    14281430 
    14291431                                new AutoAction(Message.create(SET_X_POSITION), true) { 
    14301432                                        @Override 
    14311433                                        public void performAuto() { 
    1432                                                 getChanger().setRaw(MemberElement.KEY_LOCATION, channel.setAll(newPoint)); 
     1434                                                getChanger().setRaw(MemberElement.KEY_LOCATION, newChannel); 
    14331435                                        } 
    14341436                                }.register(access); 
     1437                                 
    14351438                                return true; 
    14361439                        } 
    14371440                }, 
     
    14491452                        public boolean handle(EventR3 event) { 
    14501453                                VisualElement source = event.getSource(FrameYPosition.class); 
    14511454                                ResourceAccess access = getAccess(source); 
     1455                                LocationChannel oldChannel = MemberElement.KEY_LOCATION.get(access); 
     1456                                TimePos time = getTime(source);                          
     1457                                ImmPoint oldLocation = oldChannel.getValue(time); 
     1458                                 
    14521459                                String input = event.getEventParam(BoundControl.EventIds.INPUT_PARAM_INDEX, 
    14531460                                                String.class); 
    1454  
    1455                                 final LocationChannel location = MemberElement.KEY_LOCATION.get(access); 
    14561461                                float value = BoundValidation.parseNumber(input, Float.class); 
    1457                                 final ImmPoint newPoint = new ImmPoint(location.getValue(getTime(source)).getX(), 
    1458                                                 value); 
    1459  
     1462                                ImmPoint newLocation = new ImmPoint(oldLocation.getX(), value); 
     1463                                final LocationChannel newChannel = oldChannel.setValue(time, newLocation); 
     1464                                 
    14601465                                new AutoAction(Message.create(SET_Y_POSITION), true) { 
    14611466                                        @Override 
    14621467                                        public void performAuto() { 
    1463                                                 getChanger().setRaw(MemberElement.KEY_LOCATION, location.setAll(newPoint)); 
     1468                                                getChanger().setRaw(MemberElement.KEY_LOCATION, newChannel); 
    14641469                                        } 
    14651470                                }.register(access); 
     1471                                 
    14661472                                return true; 
    14671473                        } 
    14681474                },