Removed unnecessary parts of input processing
This commit is contained in:
parent
0e732bea40
commit
057484e119
7 changed files with 54 additions and 115 deletions
|
|
@ -443,9 +443,6 @@ void DrawingProgram::modify_grid(const NetworkingObjects::NetObjWeakPtr<WorldGri
|
|||
void DrawingProgram::update() {
|
||||
controls.cursorHoveringOverCanvas = world.main.toolbar.check_if_position_isnt_obstructed(world.main.input.mouse.pos);
|
||||
|
||||
controls.previousMouseWorldPos = controls.currentMouseWorldPos;
|
||||
controls.currentMouseWorldPos = world.get_mouse_world_pos();
|
||||
|
||||
if(addFileInNextFrame) {
|
||||
add_file_to_canvas_by_path_execute(addFileInfo.first, addFileInfo.second);
|
||||
addFileInNextFrame = false;
|
||||
|
|
@ -454,9 +451,6 @@ void DrawingProgram::update() {
|
|||
selection.update();
|
||||
drawTool->tool_update();
|
||||
|
||||
if(controls.leftClickReleased)
|
||||
controls.leftClickReleased = false;
|
||||
|
||||
update_downloading_dropped_files();
|
||||
check_updateable_components();
|
||||
|
||||
|
|
|
|||
|
|
@ -107,14 +107,8 @@ class DrawingProgram {
|
|||
struct GlobalControls {
|
||||
std::optional<WorldScalar> lockedCameraScale;
|
||||
|
||||
WorldVec previousMouseWorldPos = {0, 0};
|
||||
WorldVec currentMouseWorldPos = {0, 0};
|
||||
bool leftClick = false;
|
||||
bool leftClickHeld = false;
|
||||
bool leftClickReleased = false;
|
||||
bool middleClick = false;
|
||||
bool middleClickHeld = false;
|
||||
bool middleClickReleased = false;
|
||||
bool cursorHoveringOverCanvas = false;
|
||||
|
||||
DrawingProgramLayerManager::LayerSelector layerSelector = DrawingProgramLayerManager::LayerSelector::LAYER_BEING_EDITED;
|
||||
|
|
|
|||
|
|
@ -77,19 +77,20 @@ void GridModifyTool::input_mouse_motion_callback(const InputManager::MouseMotion
|
|||
NetworkingObjects::NetObjTemporaryPtr<WorldGrid> gLock = grid.lock();
|
||||
if(gLock) {
|
||||
WorldGrid& g = *gLock;
|
||||
auto mouseWorldPos = drawP.world.drawData.cam.c.from_space(motion.pos);
|
||||
switch(selectionMode) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
g.offset = drawP.world.get_mouse_world_pos();
|
||||
g.offset = mouseWorldPos;
|
||||
break;
|
||||
case 2:
|
||||
g.size = std::max(FixedPoint::abs(drawP.world.get_mouse_world_pos().x() - g.offset.x()), WorldScalar(1));
|
||||
g.size = std::max(FixedPoint::abs(mouseWorldPos.x() - g.offset.x()), WorldScalar(1));
|
||||
break;
|
||||
case 3:
|
||||
if(g.bounds.has_value()) {
|
||||
auto& b = g.bounds.value();
|
||||
b.min = cwise_vec_min(drawP.world.get_mouse_world_pos(), b.max);
|
||||
b.min = cwise_vec_min(mouseWorldPos, b.max);
|
||||
}
|
||||
else
|
||||
selectionMode = 0;
|
||||
|
|
@ -97,7 +98,7 @@ void GridModifyTool::input_mouse_motion_callback(const InputManager::MouseMotion
|
|||
case 4:
|
||||
if(g.bounds.has_value()) {
|
||||
auto& b = g.bounds.value();
|
||||
b.max = cwise_vec_max(drawP.world.get_mouse_world_pos(), b.min);
|
||||
b.max = cwise_vec_max(mouseWorldPos, b.min);
|
||||
}
|
||||
else
|
||||
selectionMode = 0;
|
||||
|
|
@ -191,7 +192,8 @@ void GridModifyTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
}
|
||||
if(selectionMode == 0 || selectionMode == 2) {
|
||||
Vector2f gSizeScreenPos;
|
||||
if(drawP.world.get_mouse_world_pos().x() < g.offset.x() && selectionMode == 2)
|
||||
auto mouseWorldPos = drawP.world.drawData.cam.c.from_space(drawData.main->input.mouse.pos);
|
||||
if(mouseWorldPos.x() < g.offset.x() && selectionMode == 2)
|
||||
gSizeScreenPos = drawData.cam.c.to_space(g.offset - WorldVec{g.size, 0});
|
||||
else
|
||||
gSizeScreenPos = drawData.cam.c.to_space(g.offset + WorldVec{g.size, 0});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue