That might help, but I think there is a more general problem here.
I tried unifying constraints and initial values into the constructor
args, but that required every constructor to rethink how it looks at
args.
We have two special flags for width and height, hassetwidth and
hassetheight, that perhaps should be generalize to a node protocol to
ask if an attribute has been specified or constrained (there is
currently an internal API to ask if it has been constrained in the
instance).
Instance constraints are treated differently from class constraints by
replication and states.
It's generally a mess. I don't think anyone has thought out what
really ought to happen, instead, the mechanism has just sort of
evolved as applications have needed to do different things. The
debugger console window is a really good test case, because we really
want some default constraints, but those should be overridable by use
values _or_ constraints, and on top of that, when the drag or resize
states come into play, you really want to remove _any_ constraint
(default class or instance).
The current initargs/constraints merge replicate dance does not
support that. And if you look at the hoops I had to go through to
make the debugger console window even start to conform (a flag and a
state to control the default class constraint for each of x, y,
height, width) that's a pretty good clue the mechanism is not designed
right. And even with what I have, if there is an instance constraint
there is no way to programmatically remove it (e.g., if the instance
constrains x to a %, the resize state would like to pin x but it can't).
On 2009-01-10, at 17:01EST, Henry Minsky wrote:
We
I wonder if we ought to have a feature in setAttribute where it
removes the constraint on an attribute
if there is one.
On Sat, Jan 10, 2009 at 4:56 PM, P T Withington <[email protected]> wrote:
Actually, I went back and looked at your original solution, and it is
perfectly fine. I think I would just rename
'initial_position_state to
'fit_on_canvas'. It is applied by default, and removed when you
resize.
That is pretty clean and simple, compared to the handsprings we are
trying
to do it my way!
On 2009-01-10, at 16:51EST, P T Withington wrote: