| 74 | } |
| 75 | |
| 76 | void |
| 77 | SelectionTransformTool::update (int x, int y, BitMask, BitMask buttons) |
| 78 | { |
| 79 | if (!cloud_ptr_) |
| 80 | return; |
| 81 | if (!(buttons & LEFT)) |
| 82 | return; |
| 83 | int dx = (x - x_); |
| 84 | int dy = (y - y_); |
| 85 | if (dx == 0 && dy == 0) |
| 86 | return; |
| 87 | trackball_.update(x, y); |
| 88 | |
| 89 | if (modifiers_ & CTRL) |
| 90 | { |
| 91 | // selection motion is not applied directly (waits for end) |
| 92 | // as such we can not update x and y immediately |
| 93 | float scale = 1.0f / cloud_ptr_->getScalingFactor(); |
| 94 | cloud_ptr_->setSelectionTranslation ((float) dx * translate_factor_ * scale, |
| 95 | (float) -dy * translate_factor_ * scale, |
| 96 | 0.0f); |
| 97 | return; |
| 98 | } |
| 99 | if (modifiers_ & ALT) |
| 100 | { |
| 101 | // selection motion is not applied directly (waits for end) |
| 102 | // as such we can not update x and y immediately |
| 103 | float scale = 1.0f / cloud_ptr_->getScalingFactor(); |
| 104 | cloud_ptr_->setSelectionTranslation (0.0f, |
| 105 | 0.0f, |
| 106 | (float) dy * translate_factor_ * scale); |
| 107 | return; |
| 108 | } |
| 109 | float transform[MATRIX_SIZE]; |
| 110 | trackball_.getRotationMatrix(transform); |
| 111 | transform_matrix_[12] -= center_xyz_[0]; |
| 112 | transform_matrix_[13] -= center_xyz_[1]; |
| 113 | transform_matrix_[14] -= center_xyz_[2]; |
| 114 | ::multMatrix(transform_matrix_, transform, transform_matrix_); |
| 115 | transform_matrix_[12] += center_xyz_[0]; |
| 116 | transform_matrix_[13] += center_xyz_[1]; |
| 117 | transform_matrix_[14] += center_xyz_[2]; |
| 118 | cloud_ptr_ -> setSelectionRotation(transform_matrix_); |
| 119 | |
| 120 | x_ = x; |
| 121 | y_ = y; |
| 122 | } |
| 123 | |
| 124 | void |
| 125 | SelectionTransformTool::end (int x, int y, BitMask modifiers, BitMask buttons) |
nothing calls this directly
no test coverage detected