On Wed, 12 May 2004, Carl Hetherington wrote:
Hi,
My next grid problem is this:
- Turn the grid on.
- Draw a 1x1 square on this grid using the pen tool.
Note that the nodes of this square are snapped to the grid.
- Scale this square using the handles and stop when the scale snaps near
a size of 2x2.
Now that square's nodes are no longer snapped to the grid.
AFAICS this is because the scaling makes use of the sp_item_bbox_desktop(), which includes line widths. It suggests to me that the only way to solve this problem is to have a second bounding box function that considers nodal positions only. Then this could (optionally) be used for scaling.
Any thoughts? Have I missed something?
I've always been bugged by this too. Yes you're right that it seems to be basing the snap coordinate on the bounding box rather than the snap point as you'd expect. Perhaps this was done in a desire to allow shapes to fit within the grid boundaries. For instance, I can easily see how if you're making an artistic drawing, you might want to see things snap to their "real" edges rather than to their node points. However, as you note, for technical drawing it does not work out right, since the "centerlines" are the important thing, not the line widths.
Perhaps an idea would be to provide an option in the grid/snap dialog for the following snapping behaviors:
Snap objects to their: Grid Guides outermost edges [ ] [X] node points (default) [X] [ ] center point [ ] [X] ( pivot point [ ] [ ] ) moment of inertia [ ] [ ] ( connection points [ ] [ ] )
(The last one isn't available since connection points aren't implemented, but when they are, it could be an option.)
(The pivot point currently is 'forgotten' when changing out of transform mode, but if we ever decide to store it persistently, it might be a useful snap point too.)
Moment of inertia would probably be a pain (er, 'interesting challenge') to implement but I suspect that for complicated shapes it might provide a more useful snapping point than the center of the bounding box. (Consider a lollypop or a shape with some attached dimension lines as examples.)
I think that the importance of node-point-based snapping increases in importance when we have non-square grids. I know Nathan has long been interested in adding iso, hex, etc. grid types, and the bounding-box style of snapping will just feel wrong with those kinds of grids.
Creating a bounding box from the node points rather than the outer edges may solve it, but it'd be interesting to know if it'd be possible to snap to the node points themselves. For example, wouldn't it be nice if stars could be snapped to the grid on their points?
Regarding star snapping behavior, notice that when you initially draw the star, it snaps to its center, but when you move it it snaps only to its bounding box. Erf! It probably ought to consistently do one or the other, with an option to achieve the other effect.
Also, on the topic of weird things happening when you resize stroked boxes, another technical drawing 'mis-feature' worth figuring out a good alternative solution for is how the stroke width is scaled. Normally when doing a technical drawing you will want to scale some boxes but maintain a consistent line width on everything. It would be valuable to have an option in preferences to control whether stroke width is scaled with object scaling or not.
Bryce