lmw
2023-06-16 03972ad1d3ce6ffe0be0395c0a4d5dcb4474031f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package cn.sinata.xldutils.view.util
 
import android.graphics.Matrix
import android.graphics.RectF
import android.view.MotionEvent
 
interface ZoomableController {
 
    /**
     * Listener interface.
     */
    interface Listener {
 
        /**
         * Notifies the view that the transform changed.
 
         * @param transform the new matrix
         */
        fun onTransformChanged(transform: Matrix)
    }
 
    /**
     * Gets whether the controller is enabled. This should return the last value passed to
     * [.setEnabled].
 
     * @return whether the controller is enabled.
     */
    /**
     * Enables the controller. The controller is enabled when the image has been loaded.
 
     * @param enabled whether to enable the controller
     */
    var isEnabled: Boolean
 
    /**
     * Sets the listener for the controller to call back when the matrix changes.
 
     * @param listener the listener
     */
    fun setListener(listener: Listener?)
 
    /**
     * Gets the current scale factor. A convenience method for calculating the scale from the
     * transform.
 
     * @return the current scale factor
     */
    val scaleFactor: Float
 
    /**
     * Gets the current transform.
 
     * @return the transform
     */
    val transform: Matrix
 
    /**
     * Sets the bounds of the image post transform prior to application of the zoomable
     * transformation.
 
     * @param imageBounds the bounds of the image
     */
    fun setImageBounds(imageBounds: RectF)
 
    /**
     * Sets the bounds of the view.
 
     * @param viewBounds the bounds of the view
     */
    fun setViewBounds(viewBounds: RectF)
 
    /**
     * Allows the controller to handle a touch event.
 
     * @param event the touch event
     * *
     * @return whether the controller handled the event
     */
    fun onTouchEvent(event: MotionEvent): Boolean
}