@@ -35,9 +35,9 @@ fun Modifier.zoom(
3535 consume : Boolean = true,
3636 clip : Boolean = true,
3737 zoomState : ZoomState ,
38- onGestureStart : (ZoomData ) -> Unit = {} ,
39- onGesture : (ZoomData ) -> Unit = {} ,
40- onGestureEnd : (ZoomData ) -> Unit = {},
38+ onGestureStart : (( ZoomData ) -> Unit ) ? = null ,
39+ onGesture : (( ZoomData ) -> Unit ) ? = null ,
40+ onGestureEnd : (( ZoomData ) -> Unit ) ? = null
4141) = composed(
4242 factory = {
4343 val coroutineScope = rememberCoroutineScope()
@@ -51,10 +51,10 @@ fun Modifier.zoom(
5151 detectTransformGestures(
5252 consume = consume,
5353 onGestureStart = {
54- onGestureStart(zoomState.zoomData)
54+ onGestureStart?.invoke (zoomState.zoomData)
5555 },
5656 onGestureEnd = {
57- onGestureEnd(zoomState.zoomData)
57+ onGestureEnd?.invoke (zoomState.zoomData)
5858 },
5959 onGesture = { centroid, pan, zoom, rotation, _, _ ->
6060
@@ -68,7 +68,7 @@ fun Modifier.zoom(
6868 )
6969 }
7070
71- onGesture(zoomState.zoomData)
71+ onGesture?.invoke (zoomState.zoomData)
7272 }
7373 )
7474 }
@@ -144,9 +144,9 @@ fun Modifier.zoom(
144144 consume : Boolean = true,
145145 clip : Boolean = true,
146146 zoomState : ZoomState ,
147- onGestureStart : (ZoomData ) -> Unit = {} ,
148- onGesture : (ZoomData ) -> Unit = {} ,
149- onGestureEnd : (ZoomData ) -> Unit = {},
147+ onGestureStart : (( ZoomData ) -> Unit ) ? = null ,
148+ onGesture : (( ZoomData ) -> Unit ) ? = null ,
149+ onGestureEnd : (( ZoomData ) -> Unit ) ? = null
150150) = composed(
151151 factory = {
152152 val coroutineScope = rememberCoroutineScope()
@@ -160,10 +160,10 @@ fun Modifier.zoom(
160160 detectTransformGestures(
161161 consume = consume,
162162 onGestureStart = {
163- onGestureStart(zoomState.zoomData)
163+ onGestureStart?.invoke (zoomState.zoomData)
164164 },
165165 onGestureEnd = {
166- onGestureEnd(zoomState.zoomData)
166+ onGestureEnd?.invoke (zoomState.zoomData)
167167 },
168168 onGesture = { centroid, pan, zoom, rotation, _, _ ->
169169
@@ -177,7 +177,7 @@ fun Modifier.zoom(
177177 )
178178 }
179179
180- onGesture(zoomState.zoomData)
180+ onGesture?.invoke (zoomState.zoomData)
181181 }
182182 )
183183 }
@@ -253,9 +253,9 @@ fun Modifier.zoom(
253253 consume : Boolean = true,
254254 clip : Boolean = true,
255255 zoomState : ZoomState ,
256- onGestureStart : (ZoomData ) -> Unit = {} ,
257- onGesture : (ZoomData ) -> Unit = {} ,
258- onGestureEnd : (ZoomData ) -> Unit = {},
256+ onGestureStart : (( ZoomData ) -> Unit ) ? = null ,
257+ onGesture : (( ZoomData ) -> Unit ) ? = null ,
258+ onGestureEnd : (( ZoomData ) -> Unit ) ? = null
259259) = composed(
260260 factory = {
261261 val coroutineScope = rememberCoroutineScope()
@@ -269,10 +269,10 @@ fun Modifier.zoom(
269269 detectTransformGestures(
270270 consume = consume,
271271 onGestureStart = {
272- onGestureStart(zoomState.zoomData)
272+ onGestureStart?.invoke (zoomState.zoomData)
273273 },
274274 onGestureEnd = {
275- onGestureEnd(zoomState.zoomData)
275+ onGestureEnd?.invoke (zoomState.zoomData)
276276 },
277277 onGesture = { centroid, pan, zoom, rotation, _, _ ->
278278
@@ -286,7 +286,7 @@ fun Modifier.zoom(
286286 )
287287 }
288288
289- onGesture(zoomState.zoomData)
289+ onGesture?.invoke (zoomState.zoomData)
290290 }
291291 )
292292 }
@@ -357,9 +357,9 @@ fun Modifier.zoom(
357357 clip = clip,
358358 consume = true ,
359359 zoomState = zoomState,
360- onGestureStart = {} ,
361- onGestureEnd = {} ,
362- onGesture = {}
360+ onGestureStart = null ,
361+ onGestureEnd = null ,
362+ onGesture = null
363363)
364364
365365/* *
@@ -383,9 +383,9 @@ fun Modifier.zoom(
383383 clip = clip,
384384 consume = true ,
385385 zoomState = zoomState,
386- onGestureStart = {} ,
387- onGestureEnd = {} ,
388- onGesture = {}
386+ onGestureStart = null ,
387+ onGestureEnd = null ,
388+ onGesture = null
389389)
390390
391391/* *
@@ -407,7 +407,14 @@ fun Modifier.zoom(
407407 clip = clip,
408408 consume = true ,
409409 zoomState = zoomState,
410- onGestureStart = {} ,
411- onGestureEnd = {} ,
412- onGesture = {}
410+ onGestureStart = null ,
411+ onGestureEnd = null ,
412+ onGesture = null
413413)
414+
415+ internal val ZoomState .zoomData: ZoomData
416+ get() = ZoomData (
417+ zoom = zoom,
418+ pan = pan,
419+ rotation = rotation
420+ )
0 commit comments