MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / OnMouseDown

Method OnMouseDown

Applications/LemonPaint/canvas.cpp:38–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void Canvas::OnMouseDown(vector2i_t mousePos){
39 mousePos.x -= bounds.pos.x;
40 mousePos.y -= bounds.pos.y;
41
42 if(mousePos.y > bounds.size.y - 16){
43 sBarHor.OnMouseDownRelative({mousePos.y - bounds.size.y + 16, mousePos.x});
44 return;
45 }
46
47 if(mousePos.x > bounds.size.x - 16){
48 sBarVert.OnMouseDownRelative({mousePos.y, mousePos.x - bounds.size.x + 16});
49 return;
50 }
51
52 if(!pressed){
53 lastMousePos = mousePos;
54 }
55
56 pressed = true;
57
58 DragBrush(lastMousePos, mousePos);
59
60 currentBrush->Paint(mousePos.x, mousePos.y, colour.r, colour.g, colour.b, brushScale, this);
61
62 lastMousePos = mousePos;
63}
64
65void Canvas::OnMouseUp(vector2i_t mousePos){
66 mousePos.x -= bounds.pos.x;

Callers

nothing calls this directly

Calls 2

OnMouseDownRelativeMethod · 0.80
PaintMethod · 0.45

Tested by

no test coverage detected