Permalink
Browse files

probe tooltips now use visualization font settings

Change-Id: I913e99741ab476a30f22f5e7a1b9e6aa018b50fb
  • Loading branch information...
1 parent bf781a3 commit 22d0e101f62872782323fd375ed5e39a3d5ce196 @adufilie adufilie committed May 9, 2012
View
31 WeaveUI/src/weave/utils/ProbeTextUtils.as
@@ -21,8 +21,8 @@ package weave.utils
{
import flash.display.Stage;
- import mx.controls.ToolTip;
import mx.core.IToolTip;
+ import mx.core.UIComponent;
import mx.managers.ToolTipManager;
import mx.utils.ObjectUtil;
@@ -37,7 +37,6 @@ package weave.utils
import weave.core.LinkableFunction;
import weave.core.LinkableHashMap;
import weave.primitives.Bounds2D;
- import weave.visualization.layers.SimpleInteractiveVisualization;
/**
* A static class containing functions to manage a list of probed attribute columns
@@ -162,47 +161,45 @@ package weave.utils
private static function setProbeToolTipAppearance():void
{
- (probeToolTip as ToolTip).setStyle("backgroundAlpha", Weave.properties.probeToolTipBackgroundAlpha.value);
+ (probeToolTip as UIComponent).setStyle("backgroundAlpha", Weave.properties.probeToolTipBackgroundAlpha.value);
if (isFinite(Weave.properties.probeToolTipBackgroundColor.value))
- (probeToolTip as ToolTip).setStyle("backgroundColor", Weave.properties.probeToolTipBackgroundColor.value);
-
-
-
- }
+ (probeToolTip as UIComponent).setStyle("backgroundColor", Weave.properties.probeToolTipBackgroundColor.value);
+ Weave.properties.defaultTextFormat.copyToStyle(probeToolTip as UIComponent);
+ }
- public static function showProbeToolTip(probeText:String, stageX:Number, stageY:Number, bounds:IBounds2D = null, margin:int = 5):void
+ public static var yAxisToolTip:IToolTip;
+ public static var xAxisToolTip:IToolTip;
+ public static function showProbeToolTip(probeText:String, stageX:Number, stageY:Number, bounds:IBounds2D = null, margin:int = 5):void
{
if (!probeToolTip)
probeToolTip = ToolTipManager.createToolTip('', 0, 0);
-
+
hideProbeToolTip();
if (!enableProbeToolTip.value)
- return;
+ return;
if (bounds == null)
{
var stage:Stage = WeaveAPI.topLevelApplication.stage;
tempBounds.setBounds(stage.x, stage.y, stage.stageWidth, stage.stageHeight);
bounds = tempBounds;
}
-
+
// create new tooltip
- probeToolTip.text = probeText;
- probeToolTip.visible = true;
+ probeToolTip.text = probeText;
+ probeToolTip.visible = true;
// make tooltip completely opaque because text + graphics on same sprite is slow
setProbeToolTipAppearance();
//this step is required to set the height and width of probeToolTip to the right size.
- (probeToolTip as ToolTip).validateNow();
+ (probeToolTip as UIComponent).validateNow();
var xMin:Number = bounds.getXNumericMin();
var yMin:Number = bounds.getYNumericMin();
var xMax:Number = bounds.getXNumericMax() - probeToolTip.width;
var yMax:Number = bounds.getYNumericMax() - probeToolTip.height;
- var yAxisToolTip:IToolTip = SimpleInteractiveVisualization.yAxisTooltipPtr ;
- var xAxisToolTip:IToolTip = SimpleInteractiveVisualization.xAxisTooltipPtr ;
// calculate y coordinate
var y:int;
View
45 WeaveUI/src/weave/visualization/layers/SimpleInteractiveVisualization.as
@@ -22,8 +22,8 @@ package weave.visualization.layers
import flash.events.MouseEvent;
import flash.geom.Point;
- import mx.controls.ToolTip;
import mx.core.IToolTip;
+ import mx.core.UIComponent;
import mx.managers.ToolTipManager;
import weave.Weave;
@@ -51,6 +51,7 @@ package weave.visualization.layers
import weave.utils.BitmapText;
import weave.utils.ColumnUtils;
import weave.utils.CustomCursorManager;
+ import weave.utils.ProbeTextUtils;
import weave.utils.SpatialIndex;
import weave.visualization.plotters.ProbeLinePlotter;
import weave.visualization.plotters.SimpleAxisPlotter;
@@ -395,7 +396,10 @@ package weave.visualization.layers
// create the actual tooltip
// queryBounds was set above in getMarginAndSetQueryBounds().
var ttPoint:Point = localToGlobal( new Point(queryBounds.getXCenter(), queryBounds.getYCenter()) );
- _axisToolTip = ToolTipManager.createToolTip(marginToolTip, ttPoint.x, ttPoint.y);
+ _axisToolTip = ToolTipManager.createToolTip('', ttPoint.x, ttPoint.y);
+ _axisToolTip.text = marginToolTip;
+ Weave.properties.defaultTextFormat.copyToStyle(_axisToolTip as UIComponent);
+ (_axisToolTip as UIComponent).validateNow();
// constrain the tooltip to fall within the bounds of the application
_axisToolTip.x = Math.max( 0, Math.min(_axisToolTip.x, (stageWidth - _axisToolTip.width) ) );
@@ -566,23 +570,19 @@ package weave.visualization.layers
if (xAxis || useXMax)
{
- xAxisTooltip = ToolTipManager.createToolTip(text, yPoint.x, yPoint.y);
+ ProbeTextUtils.xAxisToolTip = xAxisTooltip = ToolTipManager.createToolTip('', yPoint.x, yPoint.y);
+ xAxisTooltip.text = text;
+ setProbeToolTipAppearance();
xAxisTooltip.move(xAxisTooltip.x - (xAxisTooltip.width / 2), xAxisTooltip.y);
- xAxisTooltipPtr = xAxisTooltip;
}
else
{
- yAxisTooltip = ToolTipManager.createToolTip(text, yPoint.x, yPoint.y);
+ ProbeTextUtils.yAxisToolTip = yAxisTooltip = ToolTipManager.createToolTip('', yPoint.x, yPoint.y);
+ yAxisTooltip.text = text;
+ setProbeToolTipAppearance();
yAxisTooltip.move(yAxisTooltip.x - yAxisTooltip.width, yAxisTooltip.y - (yAxisTooltip.height / 2));
- yAxisTooltipPtr = yAxisTooltip
}
constrainToolTipsToStage(xAxisTooltip, yAxisTooltip);
- if (!yAxisTooltip)
- yAxisTooltipPtr = null;
- if (!xAxisTooltip)
- xAxisTooltipPtr = null;
- setProbeToolTipAppearance();
-
}
/**
@@ -593,9 +593,11 @@ package weave.visualization.layers
for each (var tooltip:IToolTip in [xAxisTooltip, yAxisTooltip])
if ( tooltip != null )
{
- (tooltip as ToolTip).setStyle("backgroundAlpha", Weave.properties.probeToolTipBackgroundAlpha.value);
+ (tooltip as UIComponent).setStyle("backgroundAlpha", Weave.properties.probeToolTipBackgroundAlpha.value);
if (isFinite(Weave.properties.probeToolTipBackgroundColor.value))
- (tooltip as ToolTip).setStyle("backgroundColor", Weave.properties.probeToolTipBackgroundColor.value);
+ (tooltip as UIComponent).setStyle("backgroundColor", Weave.properties.probeToolTipBackgroundColor.value);
+ Weave.properties.defaultTextFormat.copyToStyle(tooltip as UIComponent);
+ (tooltip as UIComponent).validateNow();
}
}
@@ -635,29 +637,18 @@ package weave.visualization.layers
if (yAxisTooltip != null)
{
ToolTipManager.destroyToolTip(yAxisTooltip);
- yAxisTooltip = null;
- yAxisTooltipPtr = null;
+ ProbeTextUtils.yAxisToolTip = yAxisTooltip = null;
}
if (xAxisTooltip != null)
{
ToolTipManager.destroyToolTip(xAxisTooltip);
- xAxisTooltip = null;
- xAxisTooltipPtr = null;
+ ProbeTextUtils.xAxisToolTip = xAxisTooltip = null;
}
}
private var yAxisTooltip:IToolTip = null;
private var xAxisTooltip:IToolTip = null;
- /**
- * Static pointer to the yAxisTooltip
- */
- public static var yAxisTooltipPtr:IToolTip = null ;
- /**
- * Static pointer to the xAxisTooltip
- */
- public static var xAxisTooltipPtr:IToolTip = null ;
-
public const bottomMarginClickCallbacks:ICallbackCollection = newDisposableChild(this, CallbackCollection);
public const leftMarginClickCallbacks:ICallbackCollection = newDisposableChild(this, CallbackCollection);
public const topMarginClickCallbacks:ICallbackCollection = newDisposableChild(this, CallbackCollection);

0 comments on commit 22d0e10

Please sign in to comment.