mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Merge pull request #4380 from SoundSSGood/moveChildForeground
Fixed graphical artifacts
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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()); | ||||
| } | ||||
|   | ||||
| @@ -261,4 +261,5 @@ public: | ||||
| 	void selectSlot(bool on); | ||||
| 	bool isSelected() const; | ||||
| 	void setSelectionWidth(int width); | ||||
| 	void moveSelectionForeground(); | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user