if (changed) redraw();
}
+ /**
+ * Sets a state class (eg :hover, :dupe) for this entityUI. If the state class has changed it will
+ * invalidate the style list to force the style to be recalculated during redraw.
+ */
public function setStateClass(stateType:String, isOn:*):Boolean {
if ( isOn == true ) { isOn='yes'; }
if ( isOn && stateClasses[stateType] != isOn ) {
return false;
}
+ /**
+ * applies the state classes (eg :hover, :area) for this entityUI to the given list of 'real' tags.
+ * This then gives you a modified list of tags used for styling the entityUI.
+ */
public function applyStateClasses(tags:Object):Object {
for (var stateKey:String in stateClasses) {
tags[":"+stateKey] = 'yes';
// Copy tags object, and add states
var tags:Object = entity.getTagsCopy();
- tags=applyStateClasses(tags);
- if (Way(entity).isArea()) { tags[':area']='yes'; }
- if (entity.isUneditedTiger() && Globals.vars.highlightTiger) { tags[':tiger']='yes'; }
+ setStateClass('area', Way(entity).isArea());
+ setStateClass('tiger', (entity.isUneditedTiger() && Globals.vars.highlightTiger));
+ tags=applyStateClasses(tags);
// Keep track of maximum stroke width for hitzone
var maxwidth:Number=4;