(e: KonvaEventObject<WheelEvent>)
| 180 | }; |
| 181 | |
| 182 | const handleStageWheel = (e: KonvaEventObject<WheelEvent>) => { |
| 183 | e.evt.preventDefault(); |
| 184 | |
| 185 | const stage = stageRef.current; |
| 186 | if (!stage) return; |
| 187 | |
| 188 | const pointer = stage.getPointerPosition(); |
| 189 | if (!pointer) return; |
| 190 | |
| 191 | const oldScale = stageScale; |
| 192 | const direction = e.evt.deltaY > 0 ? -1 : 1; |
| 193 | const newScaleRaw = |
| 194 | direction > 0 ? oldScale * SCALE_BY : oldScale / SCALE_BY; |
| 195 | const newScale = Math.min(MAX_SCALE, Math.max(MIN_SCALE, newScaleRaw)); |
| 196 | |
| 197 | const mousePointTo = { |
| 198 | x: (pointer.x - stagePosition.x) / oldScale, |
| 199 | y: (pointer.y - stagePosition.y) / oldScale, |
| 200 | }; |
| 201 | |
| 202 | const newPos = { |
| 203 | x: pointer.x - mousePointTo.x * newScale, |
| 204 | y: pointer.y - mousePointTo.y * newScale, |
| 205 | }; |
| 206 | |
| 207 | setStageScale(newScale); |
| 208 | setStagePosition(newPos); |
| 209 | }; |
| 210 | |
| 211 | const handleStageDragMove = (e: KonvaEventObject<DragEvent>) => { |
| 212 | const stage = e.target as Konva.Stage; |
nothing calls this directly
no outgoing calls
no test coverage detected