summary refs log tree commit diff stats
path: root/tools/mapedit
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mapedit')
-rw-r--r--tools/mapedit/src/widget.cpp22
-rw-r--r--tools/mapedit/src/widget.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/tools/mapedit/src/widget.cpp b/tools/mapedit/src/widget.cpp index 41de4ca..7f90880 100644 --- a/tools/mapedit/src/widget.cpp +++ b/tools/mapedit/src/widget.cpp
@@ -14,6 +14,7 @@ BEGIN_EVENT_TABLE(MapeditWidget, wxScrolledCanvas)
14 EVT_LEFT_UP(MapeditWidget::OnMouseUp) 14 EVT_LEFT_UP(MapeditWidget::OnMouseUp)
15 EVT_MOTION(MapeditWidget::OnMouseMove) 15 EVT_MOTION(MapeditWidget::OnMouseMove)
16 EVT_LEAVE_WINDOW(MapeditWidget::OnMouseOut) 16 EVT_LEAVE_WINDOW(MapeditWidget::OnMouseOut)
17 EVT_SCROLLWIN(MapeditWidget::OnScroll)
17END_EVENT_TABLE() 18END_EVENT_TABLE()
18 19
19MapeditWidget::MapeditWidget() 20MapeditWidget::MapeditWidget()
@@ -565,3 +566,24 @@ void MapeditWidget::RenderMap(Map* toRender, wxPaintDC& dc, wxMemoryDC& tiles_dc
565 } 566 }
566 } 567 }
567} 568}
569
570void MapeditWidget::OnScroll(wxScrollWinEvent&)
571{
572 int vX, vY, vW, vH;
573 GetViewStart(&vX, &vY);
574 GetVirtualSize(&vW, &vH);
575 int vXX, vYX;
576 GetScrollPixelsPerUnit(&vXX, &vYX);
577 vX *= vXX;
578 vY *= vYX;
579
580 if ((mousePos.x+vX >= EDITOR_SPACING_X*scale) && (mousePos.x+vX < (EDITOR_WIDTH-EDITOR_SPACING_X)*scale)
581 && (mousePos.y+vY >= EDITOR_SPACING_Y*scale) && (mousePos.y+vY < (EDITOR_HEIGHT-EDITOR_SPACING_Y)*scale))
582 {
583 mouseIsIn = true;
584 } else {
585 mouseIsIn = false;
586 }
587
588 Refresh();
589}
diff --git a/tools/mapedit/src/widget.h b/tools/mapedit/src/widget.h index 12784f8..864e299 100644 --- a/tools/mapedit/src/widget.h +++ b/tools/mapedit/src/widget.h
@@ -50,6 +50,7 @@ class MapeditWidget : public wxScrolledCanvas {
50 void OnMouseMove(wxMouseEvent& event); 50 void OnMouseMove(wxMouseEvent& event);
51 void OnMouseUp(wxMouseEvent& event); 51 void OnMouseUp(wxMouseEvent& event);
52 void OnMouseOut(wxMouseEvent& event); 52 void OnMouseOut(wxMouseEvent& event);
53 void OnScroll(wxScrollWinEvent& event);
53 54
54 private: 55 private:
55 void SetTile(wxPoint pos); 56 void SetTile(wxPoint pos);