zwcloud / ImGui

Immediate Mode GUI for C#
https://zwcloud.net/#project/imgui
GNU Affero General Public License v3.0
197 stars 21 forks source link

Create adjustable primitive. #21

Closed zwcloud closed 5 years ago

zwcloud commented 5 years ago

To update a primitive, especially a PathPrimitive, we need to re-create on and replace the original one. For example, a rectangle PathPrimitive, to change its size,

var original = node.Primitive;
//get top left point of the original rectangle
var x = ....;
var y = ....;
var rectPrimitive = new PathPrimitive();
rectPrimitive.PathRect(x, y, newSize);
node.Primitive = rectPrimitive;

We should be able to do this by introduce a new concrete primitive type RectPathPrimitive:

var primitive = node.Primitive as RectPathPrimitive;
primitive.Size = newSize;//this internally changes the path commands that construct this primitive
zwcloud commented 5 years ago

We will implement Visual based hierarchy instead, for sub-element of a composited control like ProgressBar.