[Scummvm-git-logs] scummvm master -> 9a5abe9a1b1a2daf08661cea203e22622dd2214b
elasota
noreply at scummvm.org
Fri Jun 17 01:17:46 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9a5abe9a1b MTROPOLIS: Fix hidden elements having mouse collision
Commit: 9a5abe9a1b1a2daf08661cea203e22622dd2214b
https://github.com/scummvm/scummvm/commit/9a5abe9a1b1a2daf08661cea203e22622dd2214b
Author: elasota (ejlasota at gmail.com)
Date: 2022-06-16T21:14:58-04:00
Commit Message:
MTROPOLIS: Fix hidden elements having mouse collision
Changed paths:
engines/mtropolis/runtime.cpp
diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index c0b8b3db5ae..ba52efa9771 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -4237,38 +4237,40 @@ void Runtime::recursiveFindMouseCollision(Structural *&bestResult, int32 &bestLa
Element *element = static_cast<Element *>(candidate);
if (element->isVisual()) {
VisualElement *visual = static_cast<VisualElement *>(candidate);
- int layer = visual->getLayer();
- bool isDirect = visual->isDirectToScreen();
-
- // Layering priority:
- bool isInFront = false;
- if (isDirect && !bestDirect)
- isInFront = true;
- else if (isDirect == bestDirect) {
- if (layer > bestLayer)
+
+ if (visual->isVisible()) {
+ int layer = visual->getLayer();
+ bool isDirect = visual->isDirectToScreen();
+
+ // Layering priority:
+ bool isInFront = false;
+ if (isDirect && !bestDirect)
isInFront = true;
- else if (layer == bestLayer) {
- if (stackHeight > bestStackHeight)
+ else if (isDirect == bestDirect) {
+ if (layer > bestLayer)
isInFront = true;
+ else if (layer == bestLayer) {
+ if (stackHeight > bestStackHeight)
+ isInFront = true;
+ }
}
- }
- if (isInFront && visual->isMouseInsideBox(relativeX, relativeY) && isStructuralMouseInteractive(visual, testType) && visual->isMouseCollisionAtPoint(relativeX, relativeY)) {
- bestResult = candidate;
- bestLayer = layer;
- bestStackHeight = stackHeight;
- bestDirect = isDirect;
+ if (isInFront && visual->isMouseInsideBox(relativeX, relativeY) && isStructuralMouseInteractive(visual, testType) && visual->isMouseCollisionAtPoint(relativeX, relativeY)) {
+ bestResult = candidate;
+ bestLayer = layer;
+ bestStackHeight = stackHeight;
+ bestDirect = isDirect;
+ }
}
+ // Need to check: Does hiding an element also hide its children?
childRelativeX -= visual->getRelativeRect().left;
childRelativeY -= visual->getRelativeRect().top;
}
}
-
- for (const Common::SharedPtr<Structural> &child : candidate->getChildren()) {
+ for (const Common::SharedPtr<Structural> &child : candidate->getChildren())
recursiveFindMouseCollision(bestResult, bestLayer, bestStackHeight, bestDirect, child.get(), stackHeight, childRelativeX, childRelativeY, testType);
- }
}
void Runtime::queueEventAsLowLevelSceneStateTransitionAction(const Event &evt, Structural *root, bool cascade, bool relay) {
More information about the Scummvm-git-logs
mailing list