Fix zoom offset drift on location detail
This commit is contained in:
		
							parent
							
								
									b3ab535448
								
							
						
					
					
						commit
						b6af245327
					
				
					 1 changed files with 14 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -64,12 +64,21 @@ fun FantasyMap(
 | 
			
		|||
                        scale = newScale
 | 
			
		||||
                    )
 | 
			
		||||
 | 
			
		||||
                    state.pan(
 | 
			
		||||
                        offset = Offset(
 | 
			
		||||
                            x = oldOffset.x * newScale / oldScale + pan.x,
 | 
			
		||||
                            y = oldOffset.y * newScale / oldScale + pan.y,
 | 
			
		||||
                    if (state.scale == newScale) {
 | 
			
		||||
                        state.pan(
 | 
			
		||||
                            offset = Offset(
 | 
			
		||||
                                x = oldOffset.x * newScale / oldScale + pan.x,
 | 
			
		||||
                                y = oldOffset.y * newScale / oldScale + pan.y,
 | 
			
		||||
                            )
 | 
			
		||||
                        )
 | 
			
		||||
                    )
 | 
			
		||||
                    } else {
 | 
			
		||||
                        state.pan(
 | 
			
		||||
                            offset = Offset(
 | 
			
		||||
                                x = oldOffset.x + pan.x,
 | 
			
		||||
                                y = oldOffset.y + pan.y,
 | 
			
		||||
                            )
 | 
			
		||||
                        )
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            .graphicsLayer {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue