[Kst] Lines and Arrows
George Staikos
staikos at kde.org
Sat Feb 4 14:38:03 CET 2006
Bugs 121068 and 121108 really are the same problem resulting in different
symptoms. On a micro-level they look completely different and are fixed
differently, but in the grand scheme of things I think they're just a
mis-implementation of the view object interface. A view object is specified
by its properties, its paint, and its geometry. The paint and the geometry
are entirely separate things, and the paint must be contained within the
geometry. The geometry is something used at the program level, though in
many cases it aligns directly with something at the user-interface level. In
the case of plots, labels, and boxes, the geometry and the bounds of the
object should be identical. However, in the case of lines, arrows, and
ellipses, this is not necessarily the case. This does not mean that the
geometry is meaningless, nor does it mean that the object can paint outside
the geometry. The problem with line (and arrow) is that it has "from" and
"to" properties, and those properties are presently assumed to be two
opposite corners of the bounding box. This works for a line of thickness = 1
(or 0), but nothing else. In other cases the line is drawn outside the
bounding box.
I think the correct thing is that lines should compute 'from' and 'to' based
on the geometry of the object, and not store them. When the user tries to
adjust a line by setting one of those two properties, it should compute the
bounding box/geometry required for the line, clip it to the
parent/view/whatever we want), and then adjust the 'from' or 'to' property
accordingly. Basically it should do the opposite of what I did originally,
which is to draw the largest possible line inside the bounding box. This new
idea gives the following properties:
1) 'from' and 'to' are exactly that and not just "close" for large widths.
2) painting is always inside the geometry
3) lines can still be manipulated as expected
4) lines of all widths work
One interesting side effect: making a line thicker will either make the object
geometry larger or shorten the line - or both.
How does this apply to 121108? The manipulation routines need to behave
accordingly: lines are on a from-to basis, not a bounding box basis like
other objects. they have a bounding box, but it doesn't entirely make sense
from a UI point of view. parenting needs to change in different ways in this
case.
I think this maps up to Barth's options #1 and #3 combined.
--
George Staikos
KDE Developer http://www.kde.org/
Staikos Computing Services Inc. http://www.staikos.net/
More information about the Kst
mailing list