mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Mobile: when switching to the details, reuse existing page
While pageStack.push() can handle pushing a page that's already there, that creates an unfortunate sequence of currentItemChanged signal which leads us to do the wrong thing with our map hack. This commit changes things around to first look for the page in the page stack and just switch to it, and only pushing the page as new if it cannoot be found oon the page stack. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									d8cc8732bd
								
							
						
					
					
						commit
						b07a1cc8b6
					
				
					 1 changed files with 14 additions and 1 deletions
				
			
		|  | @ -36,6 +36,14 @@ Kirigami.ScrollablePage { | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	function pageIndex(pageToFind) { | ||||
| 		for (var i = 0; i < pageStack.contentItem.contentChildren.length; i++) { | ||||
| 			if (pageStack.contentItem.contentChildren[i] === pageToFind) | ||||
| 				return i | ||||
| 		} | ||||
| 		return -1 | ||||
| 	} | ||||
| 
 | ||||
| 	Component { | ||||
| 		id: diveDelegate | ||||
| 		Kirigami.AbstractListItem { | ||||
|  | @ -112,7 +120,12 @@ Kirigami.ScrollablePage { | |||
| 				if (detailsWindow.state === "view") { | ||||
| 					diveListView.currentIndex = index | ||||
| 					detailsWindow.showDiveIndex(index); | ||||
| 					pageStack.push(detailsWindow); | ||||
| 					// switch to detailsWindow (or push it if it's not in the stack) | ||||
| 					var i = pageIndex(detailsWindow) | ||||
| 					if (i === -1) | ||||
| 						pageStack.push(detailsWindow) | ||||
| 					else | ||||
| 						pageStack.currentIndex = i | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue