1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 12:03:51 +00:00

SceneEditor: fix scaling node via mouse

This commit is contained in:
fgenesis 2024-01-13 18:47:40 +01:00
parent 22c8471bf2
commit 7a5a222b78

View file

@ -1152,7 +1152,9 @@ void SceneEditor::enterAnyStateHelper(EditorStates newstate)
else if (editType == ET_PATHS) else if (editType == ET_PATHS)
{ {
oldPosition = game->getPath(selectedIdx)->nodes[selectedNode].position; oldPosition = game->getPath(selectedIdx)->nodes[selectedNode].position;
cursorOffset = oldPosition - dsq->getGameCursorPosition(); cursorOffset = newstate == ES_SCALING
? dsq->getGameCursorPosition()
: oldPosition - dsq->getGameCursorPosition();
oldScale = Vector(editingPath->rect.x2-editingPath->rect.x1, oldScale = Vector(editingPath->rect.x2-editingPath->rect.x1,
editingPath->rect.y2-editingPath->rect.y1); editingPath->rect.y2-editingPath->rect.y1);
} }
@ -2614,8 +2616,7 @@ void SceneEditor::update(float dt)
if (editingPath) if (editingPath)
{ {
float factor = 1; float factor = 1;
Vector add = Vector((dsq->getGameCursorPosition().x - cursorOffset.x)*factor, Vector add = (dsq->getGameCursorPosition() - cursorOffset)*factor;
(dsq->getGameCursorPosition().y - cursorOffset.y)*factor);
Vector sz = oldScale + add; Vector sz = oldScale + add;
if (sz.x < 32) if (sz.x < 32)
sz.x = 32; sz.x = 32;