开发者

Flare Graph Dragging Problem

开发者 https://www.devze.com 2023-02-04 15:02 出处:网络
I am using Flare as my graphing library of choice for my current Flex project.Everything works great - my graph is being displayed correctly, but moving it poses a problem.The graph can be moved anywh

I am using Flare as my graphing library of choice for my current Flex project. Everything works great - my graph is being displayed correctly, but moving it poses a problem. The graph can be moved anywhere around the application, even outside of the graph's panel/container. It can even be placed on top of buttons and other GUI elements.

I 开发者_如何转开发need the graph to stay within its parent container, only able to move within its parent. I've spent numerous hours trying different approaches recommended by other Flare/Flex developers and nothing seems to work.

Some approaches I've tried: setting rectangular bounds on the graph's parent container, placing the parent container or the graph itself within a sprite object and setting specific bounds, and setting the clipToContent property appropriately.

I've found a few Flare demos online and each of the graph demos that are represented by nodes and vertices seem to have this same issue. This makes me thing that it's a Flare bug, but I don't want to jump to that conclusion yet.

Any help is greatly appreciated! Thanks.


I faced the same situation, and I solved it by creating a mask for my Visualization(solved or circumvented? lol):

--> in my .mxml

<mx:Panel width="65%" height="100%" layout="absolute" id="graphPanel">
  <flexvis:FlareVis id="graph" label="Graph" width="100%" height="100%" />  
  <mx:Canvas width="100%" height="100%" id="graphMask" />
</mx:Panel>

--> in actionScript:

var vis:Visualization = graph.visualization;
vis.mask = graphMask;


There are two different issues causing this problem.

1)hitarea for panning and zoom. ->while using PanZoomControl, define the hitarea,like new PanZoomControl(here to specify the hitarea). It will help to solve the problem "mouse interactive out of the vis area cause the vis moving around";

2)mask to control the display area. It will help define the area to display your vis, or the vis will go out of the boundary.

Hope this helps:)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号