some fixes
This commit is contained in:
		
							parent
							
								
									0742b0c02d
								
							
						
					
					
						commit
						5c1878bd46
					
				|  | @ -239,10 +239,8 @@ namespace kiwano | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void Node::SetZOrder(int zorder) | 	void Node::Reorder() | ||||||
| 	{ | 	{ | ||||||
| 		z_order_ = zorder; |  | ||||||
| 
 |  | ||||||
| 		if (parent_) | 		if (parent_) | ||||||
| 		{ | 		{ | ||||||
| 			NodePtr me = this; | 			NodePtr me = this; | ||||||
|  | @ -251,12 +249,12 @@ namespace kiwano | ||||||
| 
 | 
 | ||||||
| 			Node* sibling = parent_->children_.Last().Get(); | 			Node* sibling = parent_->children_.Last().Get(); | ||||||
| 
 | 
 | ||||||
| 			if (sibling && sibling->GetZOrder() > zorder) | 			if (sibling && sibling->GetZOrder() > z_order_) | ||||||
| 			{ | 			{ | ||||||
| 				sibling = sibling->PrevItem().Get(); | 				sibling = sibling->PrevItem().Get(); | ||||||
| 				while (sibling) | 				while (sibling) | ||||||
| 				{ | 				{ | ||||||
| 					if (sibling->GetZOrder() <= zorder) | 					if (sibling->GetZOrder() <= z_order_) | ||||||
| 						break; | 						break; | ||||||
| 					sibling = sibling->PrevItem().Get(); | 					sibling = sibling->PrevItem().Get(); | ||||||
| 				} | 				} | ||||||
|  | @ -273,6 +271,15 @@ namespace kiwano | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	void Node::SetZOrder(int zorder) | ||||||
|  | 	{ | ||||||
|  | 		if (z_order_ != zorder) | ||||||
|  | 		{ | ||||||
|  | 			z_order_ = zorder; | ||||||
|  | 			Reorder(); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	void Node::SetOpacity(float opacity) | 	void Node::SetOpacity(float opacity) | ||||||
| 	{ | 	{ | ||||||
| 		if (opacity_ == opacity) | 		if (opacity_ == opacity) | ||||||
|  | @ -473,7 +480,7 @@ namespace kiwano | ||||||
| 			child->SetScene(this->scene_); | 			child->SetScene(this->scene_); | ||||||
| 			child->dirty_transform_ = true; | 			child->dirty_transform_ = true; | ||||||
| 			child->UpdateOpacity(); | 			child->UpdateOpacity(); | ||||||
| 			child->SetZOrder(child->GetZOrder()); | 			child->Reorder(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -405,6 +405,8 @@ namespace kiwano | ||||||
| 
 | 
 | ||||||
| 		void SetScene(Scene* scene); | 		void SetScene(Scene* scene); | ||||||
| 
 | 
 | ||||||
|  | 		void Reorder(); | ||||||
|  | 
 | ||||||
| 	protected: | 	protected: | ||||||
| 		bool			visible_; | 		bool			visible_; | ||||||
| 		bool			hover_; | 		bool			hover_; | ||||||
|  |  | ||||||
|  | @ -22,7 +22,9 @@ | ||||||
| #include "../macros.h" | #include "../macros.h" | ||||||
| #include <functional> | #include <functional> | ||||||
| 
 | 
 | ||||||
| #ifdef KGE_DEBUG | // #define KGE_DEBUG_ENABLE_LIST_CHECK
 | ||||||
|  | 
 | ||||||
|  | #ifdef KGE_DEBUG_ENABLE_LIST_CHECK | ||||||
| #	define KGE_DEBUG_CHECK_LIST(list_ptr) list_ptr->Check() | #	define KGE_DEBUG_CHECK_LIST(list_ptr) list_ptr->Check() | ||||||
| #else | #else | ||||||
| #	define KGE_DEBUG_CHECK_LIST __noop | #	define KGE_DEBUG_CHECK_LIST __noop | ||||||
|  | @ -167,7 +169,7 @@ namespace kiwano | ||||||
| 
 | 
 | ||||||
| 		void Remove(T const& child) | 		void Remove(T const& child) | ||||||
| 		{ | 		{ | ||||||
| #ifdef KGE_DEBUG | #ifdef KGE_DEBUG_ENABLE_LIST_CHECK | ||||||
| 			T tmp = first_; | 			T tmp = first_; | ||||||
| 			while (tmp != child) | 			while (tmp != child) | ||||||
| 			{ | 			{ | ||||||
|  | @ -217,7 +219,7 @@ namespace kiwano | ||||||
| 			last_ = nullptr; | 			last_ = nullptr; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| #ifdef KGE_DEBUG | #ifdef KGE_DEBUG_ENABLE_LIST_CHECK | ||||||
| 
 | 
 | ||||||
| 	private: | 	private: | ||||||
| 		void Check() | 		void Check() | ||||||
|  | @ -250,3 +252,4 @@ namespace kiwano | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #undef KGE_DEBUG_CHECK_LIST | #undef KGE_DEBUG_CHECK_LIST | ||||||
|  | #undef KGE_DEBUG_ENABLE_LIST_CHECK | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue