summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 457ae1f)
raw | patch | inline | side by side (parent: 457ae1f)
author | Diederik van Lierop <mailat-signdiedenrezidotnl> | |
Mon, 27 Dec 2010 22:03:25 +0000 (23:03 +0100) | ||
committer | Diederik van Lierop <mailat-signdiedenrezidotnl> | |
Mon, 27 Dec 2010 22:03:25 +0000 (23:03 +0100) |
src/snap.cpp | patch | blob | history | |
src/ui/tool/transform-handle-set.cpp | patch | blob | history |
diff --git a/src/snap.cpp b/src/snap.cpp
index 85d2fd5afbac5bfe129b400bc04214b23813f1fd..f13b02b467aea2188bf87f92e764dacb0e485448 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
/* Consider the case in which a box is almost aligned with a grid in both
* horizontal and vertical directions. The distance to the intersection of
* the grid lines will always be larger then the distance to a single grid
- * line. If we prefer snapping to an intersection instead of to a single
+ * line. If we prefer snapping to an intersection over to a single
* grid line, then we cannot use "metric = Geom::L2(result)". Therefore the
* snapped distance will be used as a metric. Please note that the snapped
- * distance is defined as the distance to the nearest line of the intersection,
- * and not to the intersection itself!
+ * distance to an intersection is defined as the distance to the nearest line
+ * of the intersection, and not to the intersection itself!
*/
// Only for translations, the relevant metric will be the real snapped distance,
// so we don't have to do anything special here
if (fabs(fabs(a[index]/b[index]) - fabs(transformation[index])) > 1e-12) { // if SNAPPING DID occur in this direction
result[index] = a[index] / b[index]; // then calculate it!
}
- // we might leave result[1-index] = NR_HUGE
+ // we might have left result[1-index] = NR_HUGE
// if scaling didn't occur in the other direction
}
}
}
// Compare the resulting scaling with the desired scaling
Geom::Point scale_metric = Geom::abs(result - transformation); // One or both of its components might be NR_HUGE
- snapped_point.setSnapDistance(std::min(scale_metric[0], scale_metric[1]));
- snapped_point.setSecondSnapDistance(std::max(scale_metric[0], scale_metric[1]));
+ if (scale_metric[0] == NR_HUGE || scale_metric[1] == NR_HUGE) {
+ snapped_point.setSnapDistance(std::min(scale_metric[0], scale_metric[1]));
+ } else {
+ snapped_point.setSnapDistance(Geom::L2(scale_metric));
+ }
+ snapped_point.setSecondSnapDistance(NR_HUGE);
break;
}
case STRETCH:
if (snapped_point.getSnapped()) {
// We snapped; keep track of the best snap
- // TODO: Compare the transformations instead of the snap points; we should be looking for the closest transformation
if (best_snapped_point.isOtherSnapBetter(snapped_point, true)) {
best_transformation = result;
best_snapped_point = snapped_point;
index 209b7fe98f7587c5690a868507bfc9067a346a91..5c3b494cea9cc9b3d7353e72f16ba0836c514110 100644 (file)
_last_scale_x = _last_scale_y = 1.0;
InkNodeTool *nt = INK_NODE_TOOL(_desktop->event_context);
ControlPointSelection *selection = nt->_selected_nodes.get();
- std::cout << "startTransform()" << std::endl;
selection->setOriginalPoints();
}
virtual Geom::Matrix computeTransform(Geom::Point const &new_pos, GdkEventMotion *event) {