MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / dragManipulateSelectionTowardsLowerRight

Function dragManipulateSelectionTowardsLowerRight

test/TextureTool.cpp:1095–1133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1093}
1094
1095void 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
1135TEST_F(TextureToolTest, DragManipulateFace)
1136{

Callers 4

TEST_FFunction · 0.85

Calls 14

ConstructSelectionTestFunction · 0.85
xMethod · 0.80
yMethod · 0.80
transformPointMethod · 0.45
onManipulationStartMethod · 0.45
getActiveManipulatorMethod · 0.45
getTypeMethod · 0.45
testSelectMethod · 0.45
getPivot2WorldMethod · 0.45
getActiveComponentMethod · 0.45
beginTransformationMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected