Web platform for sharing free data for ML and research

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

Zoom to centre, for now

roundabout,
created on Monday, 6 January 2025, 14:13:29 (1736172809), received on Tuesday, 7 January 2025, 08:25:28 (1736238328)
Author identity: vlad <vlad.muntoiu@gmail.com>

b4d8c86815de8ddec03893591587848f0abacaf0

static/picture-annotation.py

@@ -718,17 +718,10 @@ def on_wheel(event):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                event.preventDefault()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            scale_exponent += (-1 if event.deltaY > 0 else 1) / 16
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            # Adjust scale exponent and compute new scale
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            scale_exponent += (-1 if event.deltaY > 0 else 1) / 4
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                new_scale = 2 ** scale_exponent
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            rect = zoom_container.getBoundingClientRect()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            pointer_x = event.clientX - rect.left
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            pointer_y = event.clientY - rect.top
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            translate_x = pointer_x - (pointer_x - translate_x) * (new_scale / scale)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            translate_y = pointer_y - (pointer_y - translate_y) * (new_scale / scale)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            # Update scale
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                scale = new_scale
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                update_transform()