Commit 0f56e813 authored by Leeor Dicker's avatar Leeor Dicker

Fixes several minor behavior bugs.

- Added responding_to_events() functions to MiniMap and TilePalette -- makes the check for whether editor needs to ignore mouse input a lot easier to read. Could be shortened to 'responding()' or 'active()' but this works.
parent e48e7639
......@@ -448,7 +448,7 @@ void EditorState::onMouseMove(int x, int y, int relX, int relY)
if(mLeftButtonDown)
{
// Avoid modifying tiles if we're in the 'toolbar area'
if (y < 32 || mTilePalette.dragging() || mMiniMap.dragging() || mMiniMap.moving_camera())
if (y < 32 || mTilePalette.responding_to_events() || mMiniMap.responding_to_events())
return;
if(mEditState == STATE_TILE_COLLISION)
......
......@@ -142,7 +142,6 @@ void MiniMap::map(Map* _m)
void MiniMap::update_minimap()
{
createMiniMap();
cout << "MiniMap::update_minimap() called." << endl;
}
......
......@@ -25,6 +25,8 @@ public:
bool dragging() const { return mDragging; }
bool moving_camera() const { return mMovingCamera; }
bool responding_to_events() const { return dragging() || moving_camera(); }
void update();
void update_minimap();
......
......@@ -184,7 +184,7 @@ void TilePalette::update()
r.drawBox(rect.x(), rect.y(), (mBrushPattern.width() * mTset->width()), (mBrushPattern.height() * mTset->height()), 255, 255, 0);
}
if(mLeftButtonDown && mMouseOverTiles)
if(mDragging && mLeftButtonDown && mMouseOverTiles)
{
Rectangle_2d rect = getRectFromPoints(mMouseCoords, mDragOrigin);
r.drawBox(rect, 255, 255, 255);
......@@ -194,6 +194,8 @@ void TilePalette::update()
void TilePalette::onMouseMove(int x, int y, int relX, int relY)
{
mMouseCoords(x, y);
if(hidden())
return;
......@@ -220,8 +222,6 @@ void TilePalette::onMouseMove(int x, int y, int relX, int relY)
return;
}
mMouseCoords(x, y);
if(isPointInRect(mMouseCoords, mTileGridRect))
mMouseOverTiles = true;
else
......
......@@ -47,6 +47,8 @@ public:
bool dragging() const { return mDragging; }
bool responding_to_events() { return dragging() || mLeftButtonDown; }
private:
typedef std::vector<std::vector<Rectangle_2d> > RectList;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment