== Tag editing ==
-** Doesn't always update selected tab when you select a new entity
* Dynamic reloading of stylesheet/map_features, so that you don't need to reload the full page when editing them
* If a select name is too long then, the select menu seems to give a horizontal scrollbar instead of the name of the item e.g. cuisine#Coffee Shop
* If you have both inputSets names and buildingAddress, and name= key is filled in then the basic tab will get both, surely only name should be shown and building name should be ignored e.g. cafes. [Actually this was an issue of addr: being missing from one of them, however this may still be a problem for other overlapping inputSets]
return;
if ( state != null )
- state.exitState();
+ state.exitState(newState);
newState.setController(this);
newState.setPreviousState(state);
state = newState;
</mx:HBox>
<flexlib:SuperTabNavigator id="editorStack" width="100%" height="100%" paddingLeft="2" paddingRight="2"
allowTabSqueezing="false" minTabWidth="10" closePolicy="close_never"
+ updateComplete="tabSelected()"
scrollSpeed="20" change="ensureEditorsPopulated(IndexChangedEvent(event).relatedObject as VBox)"/>
</mx:VBox>
tab.addChild(component);
}
}
+
+ private function tabSelected():void {
+ if (editorStack.selectedIndex<0) { return; }
+ // This fixes a Flex TabNavigator bug where the tab would be selected, but not actually skinned properly
+ for (var i:uint=0; i<editorStack.numChildren; i++) {
+ editorStack.getTabAt(i).selected=(i==editorStack.selectedIndex);
+ }
+ }
private function checkAdvanced():void {
if ( selectedEntity != null )
this.previousState = previousState;
}
+ public function isSelectionState():Boolean {
+ return true;
+ }
+
public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
return this;
}
}
public function enterState():void {}
- public function exitState():void {}
+ public function exitState(newState:ControllerState):void {}
public function toString():String {
return "(No state)";
controller.map.draggable=false;
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
controller.map.draggable=true;
Globals.vars.root.addDebug("**** <- "+this);
}
controller.map.setHighlight(selectedNode, { highlight: true } );
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
controller.map.setHighlight(selectedNode, { highlight: false } );
Globals.vars.root.addDebug("**** <- "+this);
}
controller.map.setHighlight(selectedWay, { highlight: true } );
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
controller.map.setHighlight(selectedWay, { highlight: false } );
Globals.vars.root.addDebug("**** <- "+this);
}
controller.map.setHighlight(selectedWay, { showNodes: true } );
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
controller.map.setHighlight(selectedWay, { showNodes: false } );
Globals.vars.root.addDebug("**** <- "+this);
}
controller.setCursor(controller.pen);
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
- super.exitState();
+ override public function exitState(newState:ControllerState):void {
+ super.exitState(newState);
controller.setCursor(null);
elastic.removeSprites();
elastic = null;
public function NoSelection() {
}
+ override public function isSelectionState():Boolean {
+ return false;
+ }
+
override public function processMouseEvent(event:MouseEvent, entity:Entity):ControllerState {
var focus:Entity = getTopLevelFocusEntity(entity);
override public function enterState():void {
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
Globals.vars.root.addDebug("**** <- "+this);
}
override public function toString():String {
public class SelectedPOINode extends ControllerState {
protected var initNode:Node;
-
+
public function SelectedPOINode(node:Node) {
initNode = node;
}
if ( node == selectedNode )
return;
- clearSelection();
+ clearSelection(this);
controller.setSelectedEntity(node);
controller.map.setHighlight(node, { selected: true });
selectedNode = node;
initNode = node;
}
- protected function clearSelection():void {
+ protected function clearSelection(newState:ControllerState):void {
if ( selectedNode != null ) {
controller.map.setHighlight(selectedNode, { selected: false });
- controller.setSelectedEntity(null);
+ if (!newState.isSelectionState()) { controller.setSelectedEntity(null); }
selectedNode = null;
}
}
selectNode(initNode);
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
controller.clipboards['node']=selectedNode.getTagsCopy();
- clearSelection();
+ clearSelection(newState);
Globals.vars.root.addDebug("**** <- "+this);
}
startlatp=controller.map.coord2latp(controller.map.mouseY);
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
- clearSelection();
+ override public function exitState(newState:ControllerState):void {
+ clearSelection(newState);
Globals.vars.root.addDebug("**** <- "+this);
}
if ( way == selectedWay )
return;
- clearSelection();
+ clearSelection(this);
controller.setSelectedEntity(way);
controller.map.setHighlight(way, { selected: true, showNodes: true, hover: false });
selectedWay = way;
initWay = way;
}
- protected function clearSelection():void {
+ protected function clearSelection(newState:ControllerState):void {
if ( selectedWay != null ) {
controller.map.setHighlight(selectedWay, { selected: false, showNodes: false, hover: false });
- controller.setSelectedEntity(null);
+ if (!newState.isSelectionState()) { controller.setSelectedEntity(null); }
selectedWay = null;
}
}
selectWay(initWay);
Globals.vars.root.addDebug("**** -> "+this+" "+selectedWay.id);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
controller.clipboards['way']=selectedWay.getTagsCopy();
- clearSelection();
+ clearSelection(newState);
Globals.vars.root.addDebug("**** <- "+this);
}
if ( way == selectedWay && node == selectedNode )
return;
- clearSelection();
+ clearSelection(this);
controller.setSelectedEntity(node);
controller.map.setHighlight(way, { showNodes: true, nodeSelected: node.id });
selectedWay = way; initWay = way;
selectedNode = node;
}
- override protected function clearSelection():void {
+ override protected function clearSelection(newState:ControllerState):void {
if ( selectedNode != null ) {
controller.map.setHighlight(selectedWay, { selected: false, showNodes: false, nodeSelected: null });
- controller.setSelectedEntity(null);
+ if (!newState.isSelectionState()) { controller.setSelectedEntity(null); }
selectedNode = null;
selectedWay = null;
}
selectNode(initWay,initIndex);
Globals.vars.root.addDebug("**** -> "+this);
}
- override public function exitState():void {
+ override public function exitState(newState:ControllerState):void {
controller.clipboards['node']=selectedNode.getTagsCopy();
- clearSelection();
+ clearSelection(newState);
Globals.vars.root.addDebug("**** <- "+this);
}