mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Fix error canceling tool-loop with left-button (when the user starts drawing with right-button).
This commit is contained in:
parent
e090c966bf
commit
ee612bb366
@ -1428,12 +1428,11 @@ static Message* new_mouse_msg(int type, JWidget widget)
|
|||||||
|
|
||||||
msg->mouse.x = jmouse_x(0);
|
msg->mouse.x = jmouse_x(0);
|
||||||
msg->mouse.y = jmouse_y(0);
|
msg->mouse.y = jmouse_y(0);
|
||||||
msg->mouse.flags =
|
msg->mouse.flags = (type == JM_BUTTONRELEASED ? jmouse_b(1):
|
||||||
type == JM_BUTTONRELEASED ? jmouse_b(1):
|
jmouse_b(0));
|
||||||
jmouse_b(0);
|
msg->mouse.left = ((jmouse_b(0) & 1) != (jmouse_b(1) & 1));
|
||||||
msg->mouse.left = msg->mouse.flags & 1 ? true: false;
|
msg->mouse.right = ((jmouse_b(0) & 2) != (jmouse_b(1) & 2));
|
||||||
msg->mouse.right = msg->mouse.flags & 2 ? true: false;
|
msg->mouse.middle = ((jmouse_b(0) & 4) != (jmouse_b(1) & 4));
|
||||||
msg->mouse.middle = msg->mouse.flags & 4 ? true: false;
|
|
||||||
|
|
||||||
if (widget != NULL)
|
if (widget != NULL)
|
||||||
jmessage_add_dest(msg, widget);
|
jmessage_add_dest(msg, widget);
|
||||||
|
@ -216,14 +216,18 @@ void ToolLoopManager::snapToGrid(bool flexible, Point& point)
|
|||||||
|
|
||||||
void ToolLoopManager::calculateDirtyArea(ToolLoop* loop, const Points& points, Rect& dirty_area)
|
void ToolLoopManager::calculateDirtyArea(ToolLoop* loop, const Points& points, Rect& dirty_area)
|
||||||
{
|
{
|
||||||
Point minpt, maxpt;
|
if (points.size() > 0) {
|
||||||
calculateMinMax(points, minpt, maxpt);
|
Point minpt, maxpt;
|
||||||
|
calculateMinMax(points, minpt, maxpt);
|
||||||
|
|
||||||
// Expand the dirty-area with the pen width
|
// Expand the dirty-area with the pen width
|
||||||
Rect r1, r2;
|
Rect r1, r2;
|
||||||
loop->getPointShape()->getModifiedArea(loop, minpt.x, minpt.y, r1);
|
loop->getPointShape()->getModifiedArea(loop, minpt.x, minpt.y, r1);
|
||||||
loop->getPointShape()->getModifiedArea(loop, maxpt.x, maxpt.y, r2);
|
loop->getPointShape()->getModifiedArea(loop, maxpt.x, maxpt.y, r2);
|
||||||
dirty_area = r1.createUnion(r2);
|
dirty_area = r1.createUnion(r2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dirty_area = Rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolLoopManager::calculateMinMax(const Points& points, Point& minpt, Point& maxpt)
|
void ToolLoopManager::calculateMinMax(const Points& points, Point& minpt, Point& maxpt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user