// The value in the settings file will override this.
useAntialiasing(true),
gridBackground(BACKGROUND_MAX_SIZE, BACKGROUND_MAX_SIZE),
- scale(1.0), offsetX(-10), offsetY(-10),
- document(Vector(0, 0)),
- /*gridSpacing(12.0),*/ gridPixels(0), collided(false), //rotateTool(false),
-// rx(150.0), ry(150.0),
-// scrollDrag(false), addLineTool(false), addCircleTool(false),
-// addDimensionTool(false),
- toolAction(NULL)
+ scale(1.0), offsetX(-10), offsetY(-10), document(Vector(0, 0)),
+ gridPixels(0), collided(false), toolAction(NULL)
{
document.isTopLevelContainer = true;
setBackgroundRole(QPalette::Base);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- Object::gridSpacing = 12.0;
-// toolPalette = new ToolWindow();
-// CreateCursors();
-// setCursor(cur[TOOLSelect]);
-// setMouseTracking(true);
+ Object::gridSpacing = 12.0; // In base units (inch is default)
Line * line = new Line(Vector(5, 5), Vector(50, 40), &document);
document.Add(line);
we do! :-)
*/
- SetGridSize(12);
+ SetGridSize(12); // This is in pixels
}
if (event->button() == Qt::LeftButton)
{
Vector point = Painter::QtToCartesianCoords(Vector(event->x(), event->y()));
-
-// Problem with this: Can't select stuff very well with the snap grid on.
-// Completely screws things up, as sometimes things don't fall on the grid.
-/*
-So, how to fix this? Have the Object check itself?
-Maybe we can fix this by having the initial point not be snapped, but when there's
-a drag, we substitute the snapped point 'oldPoint' which the Object keeps track of
-internally to know how far it was dragged...
-
-Now we do... :-/
-*/
-#if 0
- if (Object::snapToGrid)
- point = Object::SnapPointToGrid(point);
-#endif
-
collided = document.Collided(point);
+ // Do an update if collided with at least *one* object in the document
if (collided)
- update(); // Do an update if collided with at least *one* object in the document
+ update();
if (toolAction)
{