mirror of
				https://github.com/excalidraw/excalidraw.git
				synced 2025-11-04 04:44:31 +01:00 
			
		
		
		
	Allow changing opacity with scroll wheel (#662)
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							68ca63ec14
						
					
				
				
					commit
					f955f58bc4
				
			@@ -220,6 +220,20 @@ export const actionChangeOpacity: Action = {
 | 
			
		||||
        max="100"
 | 
			
		||||
        step="10"
 | 
			
		||||
        onChange={e => updateData(+e.target.value)}
 | 
			
		||||
        onWheel={e => {
 | 
			
		||||
          e.stopPropagation();
 | 
			
		||||
          const target = e.target as HTMLInputElement;
 | 
			
		||||
          const STEP = 10;
 | 
			
		||||
          const MAX = 100;
 | 
			
		||||
          const MIN = 0;
 | 
			
		||||
          const value = +target.value;
 | 
			
		||||
 | 
			
		||||
          if (e.deltaY < 0 && value < MAX) {
 | 
			
		||||
            updateData(value + STEP);
 | 
			
		||||
          } else if (e.deltaY > 0 && value > MIN) {
 | 
			
		||||
            updateData(value - STEP);
 | 
			
		||||
          }
 | 
			
		||||
        }}
 | 
			
		||||
        value={
 | 
			
		||||
          getFormValue(
 | 
			
		||||
            appState.editingElement,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user