質問

Can someone explain the difference/relationship between bounds and constraints in Draw2d?

I'm trying to set up a GEF editor where instances of the same EditPart class are nested inside each other (I can post a simplified version of the code if necessary, but my question is really just conceptual). Each figure has an XYLayout and I'm setting the bounds and constraints (Rectangles) of each figure in refreshVisuals.

Right now my bounds and constraints are the same for each figure. Is that correct? Since I'm using XYLayout, are the coordinates of the bounds relative to the parent Figure? How about for the constraints?

役に立ちましたか?

解決

The bounds of a child figure are only relative to the parent figure, if isCoordinateSystem() of the parent returns true - which is hardly ever the case. So in practice bounds are absolute coordinates.

The rectangles you provide as constraints in XYLayout are expected to contain coordinates relative to the parent and the layout then converts those relative coordinates in a way that is appropriate. If e.g. no figure in the parent chain has a local coordinate system, then the resulting bounds will be absolute coordinates.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top