| 1093 | } |
| 1094 | |
| 1095 | void dragManipulateSelectionTowardsLowerRight(const Vector2& startTexcoord, const render::View& view, bool cancelInsteadOfFinish = false) |
| 1096 | { |
| 1097 | auto centroid = startTexcoord; |
| 1098 | auto centroidTransformed = view.GetViewProjection().transformPoint(Vector3(centroid.x(), centroid.y(), 0)); |
| 1099 | Vector2 devicePoint(centroidTransformed.x(), centroidTransformed.y()); |
| 1100 | |
| 1101 | GlobalTextureToolSelectionSystem().onManipulationStart(); |
| 1102 | |
| 1103 | // Simulate a transformation by click-and-drag |
| 1104 | auto manipulator = GlobalTextureToolSelectionSystem().getActiveManipulator(); |
| 1105 | EXPECT_EQ(manipulator->getType(), selection::IManipulator::Drag) << "Wrong manipulator"; |
| 1106 | |
| 1107 | render::View scissored(view); |
| 1108 | ConstructSelectionTest(scissored, selection::Rectangle::ConstructFromPoint(devicePoint, Vector2(0.05, 0.05))); |
| 1109 | |
| 1110 | SelectionVolume test(scissored); |
| 1111 | manipulator->testSelect(test, GlobalTextureToolSelectionSystem().getPivot2World()); |
| 1112 | |
| 1113 | auto manipComponent = manipulator->getActiveComponent(); |
| 1114 | auto pivot2World = GlobalTextureToolSelectionSystem().getPivot2World(); |
| 1115 | manipComponent->beginTransformation(pivot2World, scissored, devicePoint); |
| 1116 | |
| 1117 | // Move the device point a bit to the lower right |
| 1118 | auto secondDevicePoint = devicePoint + (Vector2(1, -1) - devicePoint) / 2; |
| 1119 | |
| 1120 | render::View scissored2(view); |
| 1121 | ConstructSelectionTest(scissored2, selection::Rectangle::ConstructFromPoint(secondDevicePoint, Vector2(0.05, 0.05))); |
| 1122 | |
| 1123 | manipComponent->transform(pivot2World, scissored2, secondDevicePoint, selection::IManipulator::Component::Constraint::Unconstrained); |
| 1124 | |
| 1125 | if (!cancelInsteadOfFinish) |
| 1126 | { |
| 1127 | GlobalTextureToolSelectionSystem().onManipulationFinished(); |
| 1128 | } |
| 1129 | else |
| 1130 | { |
| 1131 | GlobalTextureToolSelectionSystem().onManipulationCancelled(); |
| 1132 | } |
| 1133 | } |
| 1134 | |
| 1135 | TEST_F(TextureToolTest, DragManipulateFace) |
| 1136 | { |
no test coverage detected