diff options
author | Borja Lorente | 2016-07-13 15:31:07 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-14 18:54:52 +0200 |
commit | 2ba8b1ca8c418e3c3b3f5d90155e1a76eb95f16e (patch) | |
tree | 163b5156587602bf10048eca85f1561b637f017e | |
parent | 777923be660749e792d993be9f8f2c08fb801dc4 (diff) | |
download | scummvm-rg350-2ba8b1ca8c418e3c3b3f5d90155e1a76eb95f16e.tar.gz scummvm-rg350-2ba8b1ca8c418e3c3b3f5d90155e1a76eb95f16e.tar.bz2 scummvm-rg350-2ba8b1ca8c418e3c3b3f5d90155e1a76eb95f16e.zip |
MACVENTURE: FIx pesky random drag selection
-rw-r--r-- | engines/macventure/gui.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 71a7d0c132..a056e1ba23 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -716,8 +716,8 @@ void Gui::drawDraggedObject() { ImageAsset *asset = _assets[_draggedObj.id]; _draggedSurface.create(asset->getWidth(), asset->getHeight(), _screen.format); - //_screen.copyRectToSurface(_draggedSurface, _draggedObj.pos.x, _draggedObj.pos.y, - // Common::Rect(asset->getWidth() - 1, asset->getHeight() - 1)); + _screen.copyRectToSurface(_draggedSurface, _draggedObj.pos.x, _draggedObj.pos.y, + Common::Rect(asset->getWidth() - 1, asset->getHeight() - 1)); asset->blitInto(&_draggedSurface, 0, 0, kBlitBIC); @@ -936,14 +936,8 @@ WindowReference Gui::findObjWindow(ObjID objID) { return kNoWindow; } -bool Gui::canBeSelected(ObjID obj, const Common::Event &event, const Common::Rect &clickRect, WindowReference ref) { - return (_engine->isObjVisible(obj) && - _engine->isObjClickable(obj) && - isRectInsideObject(clickRect, obj)); -} - void Gui::checkSelect(const WindowData &data, const Common::Event &event, const Common::Rect &clickRect, WindowReference ref) { - ObjID child; + ObjID child = 0; for (Common::Array<DrawableObject>::const_iterator it = data.children.begin(); it != data.children.end(); it++) { if (canBeSelected((*it).obj, event, clickRect, ref)) { child = (*it).obj; @@ -952,6 +946,12 @@ void Gui::checkSelect(const WindowData &data, const Common::Event &event, const if (child != 0) selectDraggable(child, ref, event.mouse); } +bool Gui::canBeSelected(ObjID obj, const Common::Event &event, const Common::Rect &clickRect, WindowReference ref) { + return (_engine->isObjVisible(obj) && + _engine->isObjClickable(obj) && + isRectInsideObject(clickRect, obj)); +} + bool Gui::isRectInsideObject(Common::Rect target, ObjID obj) { if (_assets.contains(obj) && //_engine->isObjClickable(obj) && @@ -993,7 +993,7 @@ void Gui::handleDragRelease(Common::Point pos, bool shiftPressed, bool isDoubleC ObjID destObject = getWindowData(destinationWindow).objRef; pos -= (_draggedObj.startPos - _draggedObj.mouseOffset); pos = localize(pos, _draggedObj.startWin, destinationWindow); - debug("drop the object at obj %d, pos (%d, %d)", destObject, pos.x, pos.y); + debug("drop the object %d at obj %d, pos (%d, %d)", _draggedObj.id, destObject, pos.x, pos.y); _engine->handleObjectDrop(_draggedObj.id, pos, destObject); } |