Permalink
Browse files

draw > centerline cross: add two lines in one transaction

  • Loading branch information...
1 parent 86ce5d5 commit eaf1d4759ca144117ae2e332139848d4cc2b6482 @qcad committed Dec 16, 2013
Showing with 12 additions and 5 deletions.
  1. +2 −1 scripts/Help/About/AboutCredits.js
  2. +10 −4 scripts/Misc/MiscDraw/Cross/Cross.js
View
3 scripts/Help/About/AboutCredits.js
@@ -9,7 +9,8 @@ var credits =
[ "Robert S.", "Direct distance entry, " +
"Snap > X/Y from Points, " +
"Snap > Y/X from Points, " +
- "Snap > Distance Manual" ],
+ "Snap > Distance Manual" +
+ "Misc > Drawing > Centerline Cross"],
[ "Tamas Tevesz", "Port to FreeBSD, " +
"various improvements and fixes." ],
],
View
14 scripts/Misc/MiscDraw/Cross/Cross.js
@@ -18,7 +18,6 @@
*/
include("scripts/EAction.js");
-//include("scripts/Apollonius.js");
include("scripts/ShapeAlgorithms.js");
/**
@@ -151,14 +150,17 @@ Cross.prototype.drawCross = function(shape) {
point4 = cp.operator_add(v);
}
+ var op = new RAddObjectsOperation();
+ var empty = true;
+
// draw horizontal line from point1 to point2
if (!point1.equalsFuzzy(point2)) {
var line = new RLineEntity(
this.getDocument(),
new RLineData(point1, point2)
)
- var op = new RAddObjectOperation(line);
- this.getDocumentInterface().applyOperation(op);
+ op.addObject(line);
+ empty = false;
}
// draw vertical line from point3 to point4
@@ -167,7 +169,11 @@ Cross.prototype.drawCross = function(shape) {
this.getDocument(),
new RLineData(point3, point4)
)
- op = new RAddObjectOperation(line);
+ op.addObject(line);
+ empty = false;
+ }
+
+ if (!empty) {
this.getDocumentInterface().applyOperation(op);
}
};

0 comments on commit eaf1d47

Please sign in to comment.