| 655 | } |
| 656 | |
| 657 | void TransformControls::updateSizeInPixel() |
| 658 | { |
| 659 | if ( params_.sizeType != VisualParams::SizeType::Pixels ) |
| 660 | return; |
| 661 | |
| 662 | if ( !translateControls_[0] ) |
| 663 | return; |
| 664 | |
| 665 | auto parent = translateControls_[0]->parent(); |
| 666 | if ( !parent ) |
| 667 | return; |
| 668 | |
| 669 | auto mask = getViewerInstance().getPresentViewports(); |
| 670 | for ( auto idViewport : mask ) |
| 671 | { |
| 672 | const auto& xf = parent->worldXf(idViewport); |
| 673 | const auto& center = xf( getCenter() ); |
| 674 | float lenPerPixel = getViewerInstance().viewport( idViewport ).getPixelSizeAtPoint( center ); |
| 675 | |
| 676 | AffineXf3f pixelTransform; |
| 677 | |
| 678 | auto radius = params_.radius * lenPerPixel ; |
| 679 | pixelTransform = AffineXf3f::xfAround( Matrix3f::scale( radius ), getCenter() ); |
| 680 | |
| 681 | for ( int i = int( Axis::X ); i < int( Axis::Count ); ++i ) |
| 682 | { |
| 683 | translateControls_[i]->setXf( pixelTransform, idViewport ); |
| 684 | rotateControls_[i]->setXf( pixelTransform, idViewport ); |
| 685 | } |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | void TransformControls::resetSizeInPixel_() |
| 690 | { |