Commits

Anonymous committed 9051881

Fix another case of wrong zValue computation

if a player gets or discards a tile, the tiles he already has
did not show correctly during the animated move, the wrong
tiles were elevated. Now tiles that only change x position
(relative to board) are not considered to be moving tiles
anymore.

  • Participants
  • Parent commits c250a44

Comments (0)

Files changed (1)

File kajongg/src/tile.py

         boardLevel = self.tile.board.level if self.tile.board else ZValues.boardLevelFactor
         moving = 0
         # show moving tiles above non-moving tiles
-        if self.tile.activeAnimation.get('pos'):
-            moving = ZValues.moving
+        changePos = self.tile.activeAnimation.get('pos')
+        changeRotation = self.tile.activeAnimation.get('rotation')
+        changeScale = self.tile.activeAnimation.get('scale')
         # show rotating and scaling tiles above all others
-        if self.tile.activeAnimation.get('scale') or self.tile.activeAnimation.get('rotation'):
+        if changeScale or changeRotation:
+            moving += ZValues.moving
             moving += ZValues.boardLevelFactor
+        elif changePos:
+            if self.rotation() % 180 == 0:
+                currentY = self.y()
+                newY = changePos.unpackEndValue().y()
+            else:
+                currentY = self.x()
+                newY = changePos.unpackEndValue().x()
+            if currentY != newY:
+                moving += ZValues.moving
         self.setZValue(moving + \
             boardLevel + \
             (self.tile.level+(2 if self.tile.element !='Xy' else 1))*ZValues.itemLevelFactor + \