aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure
diff options
context:
space:
mode:
Diffstat (limited to 'engines/macventure')
-rw-r--r--engines/macventure/gui.cpp14
-rw-r--r--engines/macventure/gui.h2
2 files changed, 9 insertions, 7 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index ed9bad6720..738ea900af 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -683,7 +683,9 @@ void Gui::drawObjectsInWindow(WindowReference target, Graphics::ManagedSurface *
// For test
if (MACVENTURE_DEBUG_GUI) {
- surface->frameRect(_engine->getObjBounds(child), kColorGreen);
+ Common::Rect testBounds = _engine->getObjBounds(child);
+ testBounds.translate(-data.scrollPos.x, -data.scrollPos.y);
+ surface->frameRect(testBounds, kColorGreen);
}
}
@@ -982,7 +984,7 @@ void Gui::checkSelect(const WindowData &data, const Common::Event &event, const
child = (*it).obj;
}
}
- if (child != 0) selectDraggable(child, ref, event.mouse);
+ if (child != 0) selectDraggable(child, ref, event.mouse, data.scrollPos);
}
bool Gui::canBeSelected(ObjID obj, const Common::Event &event, const Common::Rect &clickRect, WindowReference ref) {
@@ -1004,12 +1006,12 @@ bool Gui::isRectInsideObject(Common::Rect target, ObjID obj) {
return _assets[obj]->isRectInside(intersection);
}
-void Gui::selectDraggable(ObjID child, WindowReference origin, Common::Point click) {
+void Gui::selectDraggable(ObjID child, WindowReference origin, Common::Point click, Common::Point scroll) {
if (_engine->isObjClickable(child) && _draggedObj.id == 0) {
_draggedObj.hasMoved = false;
_draggedObj.id = child;
_draggedObj.startWin = origin;
- _draggedObj.mouseOffset = (_engine->getObjPosition(child) + getWindowSurfacePos(origin)) - click;
+ _draggedObj.mouseOffset = (_engine->getObjPosition(child) + getWindowSurfacePos(origin)) - click - scroll;
_draggedObj.pos = click + _draggedObj.mouseOffset;
_draggedObj.startPos = _draggedObj.pos;
}
@@ -1263,7 +1265,7 @@ bool MacVenture::Gui::processMainGameEvents(WindowClick click, Common::Event & e
WindowData &data = findWindowData(kMainGameWindow);
Common::Point pos;
// Click rect to local coordinates. We assume the click is inside the window ^
- Common::Rect clickRect = calculateClickRect(event.mouse, _mainGameWindow->getDimensions());
+ Common::Rect clickRect = calculateClickRect(event.mouse + data.scrollPos, _mainGameWindow->getDimensions());
checkSelect(data, event, clickRect, kMainGameWindow);
}
return false;
@@ -1371,7 +1373,7 @@ bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) {
if (click == kBorderInner) {
Common::Point pos;
// Click rect to local coordinates. We assume the click is inside the window ^
- Common::Rect clickRect = calculateClickRect(event.mouse, win->getDimensions());
+ Common::Rect clickRect = calculateClickRect(event.mouse + data.scrollPos, win->getDimensions());
checkSelect(data, event, clickRect, (WindowReference)ref);
}
}
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index 902aa8c142..8b0cbc6a6b 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -232,7 +232,7 @@ private: // Methods
bool canBeSelected(ObjID obj, const Common::Event &event, const Common::Rect &clickRect, WindowReference ref);
void checkSelect(const WindowData &data, const Common::Event &event, const Common::Rect &clickRect, WindowReference ref);
bool isRectInsideObject(Common::Rect target, ObjID obj);
- void selectDraggable(ObjID child, WindowReference origin, Common::Point startPos);
+ void selectDraggable(ObjID child, WindowReference origin, Common::Point startPos, Common::Point scroll);
void handleDragRelease(Common::Point pos, bool shiftPressed, bool isDoubleClick);
Common::Rect calculateClickRect(Common::Point clickPos, Common::Rect windowBounds);
Common::Point localize(Common::Point point, WindowReference origin, WindowReference target);