Skip to content

Commit a077a6d

Browse files
WandererFanyorikvanhavre
authored andcommitted
Tweak Linear Dim Cosmetics
1 parent 97ebbf2 commit a077a6d

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/Mod/TechDraw/Gui/QGIViewDimension.cpp

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void QGIViewDimension::draw()
356356
// text to left of vertical dims
357357
// text above horizontal dims
358358
Base::Vector3d dirDist, normDist; //direction/normal vectors of distance line
359-
Base::Vector3d dirExt, normExt;
359+
Base::Vector3d dirExt;
360360
Base::Vector3d dirDim, normDim;
361361
Base::Vector3d dirIso;
362362
dirDist = vecDist;
@@ -386,7 +386,6 @@ void QGIViewDimension::draw()
386386
dirExt = findIsoExt(dirIso);
387387
}
388388
dirExt.Normalize();
389-
normExt = Base::Vector3d (-dirExt.y,dirExt.x, 0); //normal to extension lines (req'd?)
390389

391390
// Get magnitude of angle between dimension line and horizontal
392391
double angle = atan2(dirDim.y,dirDim.x);
@@ -430,26 +429,21 @@ void QGIViewDimension::draw()
430429

431430
//fauxCenter is where the dimText would be if it was on the dimLine
432431
Base::Vector3d fauxCenter = lblCenter + textOffset * textNorm;
433-
Base::Vector3d vec = fauxCenter - midDist;
434-
float sepDistDir = vec.x * textNorm.x + vec.y * textNorm.y; //dist between distance & dimension lines
435432

436433
margin = Rez::guiX(2.f);
437434
float scaler = 1.;
438435

439-
float extStartOffset = (sepDistDir + distStartDelta < 0) ? -margin : margin;
440-
float extEndOffset = (sepDistDir < 0) ? -margin : margin;
441-
436+
//intersection of extention lines and dimension line
442437
Base::Vector3d startIntercept = DrawUtil::Intersect2d(startDist, dirExt,
443438
fauxCenter,dirDim);
444439
Base::Vector3d endIntercept = DrawUtil::Intersect2d(endDist, dirExt,
445440
fauxCenter,dirDim);
446441

442+
Base::Vector3d dirExtActual = (startIntercept - startDist);
443+
dirExtActual.Normalize();
444+
Base::Vector3d extStartEnd = startIntercept + dirExtActual * (margin * scaler);
445+
Base::Vector3d extEndEnd = endIntercept + dirExtActual * (margin * scaler);
447446

448-
Base::Vector3d extStartEnd = startIntercept + dirExt * (extStartOffset * scaler); //the little bit past the dimline
449-
Base::Vector3d extEndEnd = endIntercept + dirExt * (extEndOffset * scaler);
450-
451-
//dim1Tip is the position of 1 arrow point (lhs on a horizontal)
452-
//dim2Tail is the position of the other arrow point (rhs)
453447
//case 1: inner placement: text between extensions & fits. arros point out from inside (default)
454448
//case 2: inner placement2: text too big to fit. arrows point in from outside
455449
//case 3: outer placement: text is outside extensions. arrows point in, 1 arrow tracks dimText
@@ -491,14 +485,10 @@ void QGIViewDimension::draw()
491485

492486
// Extension lines
493487
QPainterPath path;
494-
Base::Vector3d dirExtActual = (extStartEnd - startDist); //TODO: dirExt is sometimes backwards.
495-
dirExtActual.Normalize();
496488
Base::Vector3d gap = startDist + dirExtActual * (margin * scaler); //space ext line a bt
497489
path.moveTo(gap.x, gap.y);
498490
path.lineTo(extStartEnd.x, extStartEnd.y);
499491

500-
dirExtActual = (extEndEnd - endDist); //TODO: dirExt is sometimes backwards.
501-
dirExtActual.Normalize();
502492
gap = endDist + dirExtActual * (margin * scaler);
503493
path.moveTo(gap.x, gap.y);
504494
path.lineTo(extEndEnd.x, extEndEnd.y);

0 commit comments

Comments
 (0)