import flash.external.ExternalInterface;
import flash.events.*;
import flash.geom.*;
+ import flash.display.*;
import flash.ui.Keyboard;
+ import flash.ui.Mouse;
+ import flash.ui.MouseCursorData;
import flash.text.TextField;
import mx.controls.TextArea;
if (this.moveFunction) {
map.addEventListener(MapEvent.MOVE, moveHandler);
}
+
+ createBitmapCursor("pen" ,new pen());
+ createBitmapCursor("pen_x" ,new pen_x());
+ createBitmapCursor("pen_o" ,new pen_o());
+ createBitmapCursor("pen_so" ,new pen_so());
+ createBitmapCursor("pen_plus",new pen_plus());
}
public function setActive():void {
}
/** Set a mouse pointer. */
- public function setCursor(cursor:Class):void {
- CursorManager.removeAllCursors();
- if (cursor && cursorsEnabled) { CursorManager.setCursor(cursor,2,-4,0); }
+ public function setCursor(name:String=""):void {
+ if (name && cursorsEnabled) { Mouse.cursor=name; }
+ else { Mouse.cursor=flash.ui.MouseCursor.AUTO; }
+ }
+
+ private function createBitmapCursor(name:String, source:Bitmap, hotX:int=4, hotY:int=0):void {
+ var bitmapVector:Vector.<BitmapData> = new Vector.<BitmapData>(1, true);
+ bitmapVector[0] = source.bitmapData;
+ var cursorData:MouseCursorData = new MouseCursorData();
+ cursorData.hotSpot = new Point(hotX,hotY);
+ cursorData.data = bitmapVector;
+ Mouse.registerCursor(name, cursorData);
}
private function toggleSize():void {
// set cursor depending on whether we're floating over the start of this way,
// another random node, a possible junction...
if (entity is Node && focus is Way && Way(focus).endsWith(Node(entity))) {
- if (focus==firstSelected) { controller.setCursor(controller.pen_so); }
- else { controller.setCursor(controller.pen_o); }
+ if (focus==firstSelected) { controller.setCursor("pen_so"); }
+ else { controller.setCursor("pen_o"); }
} else if (entity is Node) {
- controller.setCursor(controller.pen_x);
+ controller.setCursor("pen_x");
} else {
- controller.setCursor(controller.pen_plus);
+ controller.setCursor("pen_plus");
}
} else if ( event.type == MouseEvent.MOUSE_OUT && !isBackground ) {
if (focus is Way && entity!=firstSelected) {
// ** We could do with an optional way of calling WayUI.redraw to only do the nodes, which would be a
// useful optimisation.
}
- controller.setCursor(controller.pen);
+ controller.setCursor("pen");
}
return this;
var node:Node = Way(firstSelected).getNode(editEnd ? Way(firstSelected).length-1 : 0);
var start:Point = new Point(node.lon, node.latp);
elastic = new Elastic(controller.map, start, start);
- controller.setCursor(controller.pen);
+ controller.setCursor("pen");
}
override public function exitState(newState:ControllerState):void {
Way(firstSelected).removeEventListener(Connection.WAY_NODE_REMOVED, fixElastic);
Way(firstSelected).removeEventListener(Connection.WAY_NODE_ADDED, fixElastic);
super.exitState(newState);
- controller.setCursor(null);
+ controller.setCursor();
elastic.removeSprites();
elastic = null;
}