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
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,We should be able to do this by introduce a new concrete primitive type
RectPathPrimitive
: