summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/ScaleWidget.java
blob: 4ee1084565820ef4e087d0c425f5dfab5d64a792 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package NET.worlds.scape;

import NET.worlds.console.Console;

class ScaleWidget extends WidgetButton {
   public ScaleWidget(ToolBar toolbar) {
      super(toolbar, "scale.gif", Console.message("Scale"));
   }

   @Override
   public String drag(boolean initialDrag, float deltax, float deltay) {
      WObject wobj = this.getWObject();
      float delta = Math.abs(deltax) > Math.abs(deltay) ? deltax : deltay;
      delta = (float)Math.pow(1.01, delta);
      if (initialDrag) {
         Console.getFrame().getEditTile().addUndoable(new UndoablTransform(wobj));
      }

      wobj.scale(delta);
      wobj.markEdited();
      return "Scale: " + wobj.getScale();
   }
}