Skip to content

Commit 1436bcf

Browse files
author
tpat
committed
Fixed scaling when normalized by largest vector
1 parent 7cd57a2 commit 1436bcf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Modules/Legacy/Visualization/ShowAndEditDipoles.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,25 +375,25 @@ void ShowAndEditDipoles::adjustPositionFromTransform(const Transform& transformM
375375
auto bbox = fh->vmesh()->get_bounding_box();
376376
bool is_vector = (arrows_[id]->isVector());
377377

378-
379-
if (state->getValue(Sizing).toInt() == SizingType::NORMALIZE_BY_LARGEST_VECTOR)
380-
scale_[id] /= state->getValue(LargestSize).toDouble();
381-
382378
if(state->getValue(MoveDipolesTogether).toBool() && (type == ArrowWidgetSection::CYLINDER || type == ArrowWidgetSection::SPHERE))
379+
{
383380
moveDipolesTogether(transformMatrix);
381+
}
384382
else
385383
{
386384
pos_[id] = transformMatrix * pos_[id];
387385
direction_[id] = transformMatrix * direction_[id];
388386
scale_[id] = direction_[id].length() * scale_[id];
389387
direction_[id].normalize();
390388
}
391-
makeScalesPositive();
389+
makeScalesPositive();
390+
391+
double currentScale = scale_[id] * state->getValue(WidgetScaleFactor).toDouble();
392+
if (state->getValue(Sizing).toInt() == SizingType::NORMALIZE_BY_LARGEST_VECTOR)
393+
currentScale /= state->getValue(LargestSize).toDouble();
392394

393-
arrows_[id] = WidgetFactory::createArrowWidget(
394-
*this, "SAED",
395-
scale_[id] * state->getValue(WidgetScaleFactor).toDouble(), pos_[id],
396-
direction_[id], resolution_, is_vector, id, ++widgetIter_, bbox);
395+
arrows_[id] = WidgetFactory::createArrowWidget(*this, "SAED", currentScale, pos_[id], direction_[id],
396+
resolution_, is_vector, id, ++widgetIter_, bbox);
397397
}
398398

399399
void ShowAndEditDipoles::ReceiveInputPoints()

0 commit comments

Comments
 (0)