Better Snapping to the Grid

February 12, 2013

At a zoom level of 1, the default starting zoom level, one inch of mechanism is displayed on one inch of screen space. That applies to all screens that have the typical pixel size and shape although now days, there seems to be a trend in computer monitors to increase pixel size as if the screen is a TV. I WANT MORE PIXELS! Alas, anything over 1920×1080 is getting rare.

The grid in the Linkage program was broke. I threw in the grid snap feature but I have still not let a user specify the grid size. It was for the convenience of lining things up before there was an object snap. Now, the grid seems to be a painful reminder of half-assed feature design.

I’ve changed all of that (except that it still cannot be set buy the user) and now the grid is in a rational number of units and changes as zoom is changed. It isn’t quite right for inches but for millimeters, the grid is always around 20 to 30 pixels of screen space wide and is always some even number of millimeters.

Some Measurement Lines

I also threw in a measurement line element in the elements list, both on the ribbon bar and in the elements popup menu.

Element Popup Menu

I will need to work on the popup gallery code if I get any more elements in there. It will need to be on two lines.

Other Linkage Work

I have also been refactoring the code (what a silly work for “improving”) so that the object handling the actual screen, printer, image, video, displays, does not know as much about the inner workings of the mechanism document object. I need that code to only have features that are part of the display process and not part of the mechanism handling process. This will aid in porting the code to other platforms in the future.

I have also been trying to improve the code so that invalid operations are not possible. Adding a connector to a link that is an actuator is not valid and would cause very odd display problems. There are numerous other things like this that I keep finding and fixing.