소스 검색

Merge pull request #4380 from SoundSSGood/moveChildForeground

Fixed graphical artifacts
Ivan Savenko 1 년 전
부모
커밋
97357071b0
5개의 변경된 파일18개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      client/gui/CIntObject.cpp
  2. 2 0
      client/gui/CIntObject.h
  3. 1 0
      client/widgets/CArtPlace.cpp
  4. 5 0
      client/widgets/MiscWidgets.cpp
  5. 1 0
      client/widgets/MiscWidgets.h

+ 9 - 0
client/gui/CIntObject.cpp

@@ -258,6 +258,15 @@ void CIntObject::redraw()
 	}
 }
 
+void CIntObject::moveChildForeground(const CIntObject * childToMove)
+{
+	for(auto child = children.begin(); child != children.end(); child++)
+		if(*child == childToMove && child != children.end())
+		{
+			std::rotate(child, child + 1, children.end());
+		}
+}
+
 bool CIntObject::receiveEvent(const Point & position, int eventType) const
 {
 	return pos.isInside(position);

+ 2 - 0
client/gui/CIntObject.h

@@ -102,6 +102,8 @@ public:
 	void showAll(Canvas & to) override;
 	//request complete redraw of this object
 	void redraw() override;
+	// Move child object to foreground
+	void moveChildForeground(const CIntObject * childToMove);
 
 	/// returns true if this element is a popup window
 	/// called only for windows

+ 1 - 0
client/widgets/CArtPlace.cpp

@@ -90,6 +90,7 @@ CArtPlace::CArtPlace(Point position, const CArtifactInstance * art)
 
 	image = std::make_shared<CAnimImage>(AnimationPath::builtin("artifact"), imageIndex);
 	image->disable();
+	moveSelectionForeground();
 }
 
 const CArtifactInstance * CArtPlace::getArt() const

+ 5 - 0
client/widgets/MiscWidgets.cpp

@@ -714,3 +714,8 @@ void SelectableSlot::setSelectionWidth(int width)
 	selection = std::make_shared<TransparentFilledRectangle>( selection->pos - pos.topLeft(), Colors::TRANSPARENCY, Colors::YELLOW, width);
 	selectSlot(selected);
 }
+
+void SelectableSlot::moveSelectionForeground()
+{
+	moveChildForeground(selection.get());
+}

+ 1 - 0
client/widgets/MiscWidgets.h

@@ -261,4 +261,5 @@ public:
 	void selectSlot(bool on);
 	bool isSelected() const;
 	void setSelectionWidth(int width);
+	void moveSelectionForeground();
 };