Android Question CamZoom + Focus at same panel

Douglas Farias

Expert
Licensed User
Longtime User
hi all
i m using this to make a zoom and make a focus
B4X:
Sub paineltransparentcamera_Touch (Action As Int, X As Float, Y As Float) As Boolean

    Select Case Action
   
   
        Case Activity.ACTION_DOWN
    If FocusSupported Then
    Dim rect1 As Rect
    Dim myleft As Int
    Dim mytop As Int
    myleft = 20%x
    mytop = Min(Max((Y/paineltransparentcamera.height)*2000 - 1000 -100, -1000),800)
        pnfocus.Top = paineltransparentcamera.Top + Y -paineltransparentcamera.height/16
        pnfocus.Left = paineltransparentcamera.Left + X -paineltransparentcamera.width/20
        pnfocus.width = 20%x
        pnfocus.height = paineltransparentcamera.height/8
        pnfocus.Visible = False
        pnfocus.Visible = True
        focuscolor = Colors.white
        cvsDrawing.Drawline( 0,0,0,pnfocus.height ,focuscolor, 2dip)
        cvsDrawing.DrawLine( 0, 0,pnfocus.width, 0 ,focuscolor,2dip)
        cvsDrawing.DrawLine( pnfocus.width, pnfocus.height,0, pnfocus.height ,focuscolor,2dip)
        cvsDrawing.DrawLine( pnfocus.width, pnfocus.height,pnfocus.width, 0 ,focuscolor,2dip)
        rect1.Initialize(myleft,mytop,myleft + 20%x , mytop + 200)
        camEx.SetFocusArea(rect1, 1000 )
        camEx.setFocusMode("auto")
        camEx.commitparameters
        camEx.focus   
    End If
    Return True
   
   
   
   
   
   
   
    Case Activity.ACTION_MOVE
    camEx.Zoom = porcentagem(Y)
    camEx.CommitParameters  
     Return True
   
   
   
    End Select
Return True   
End Sub

this works sometimes good, but for example, how can i make like a native camera? if user move to up give zoom + , if move down give zoom -, i m using action.move and this is working, but i want to use the focus too, and all time i make zoom the focus make too, have a way to separate zoom / focus at same panel? for example click = focus, move = zoom?

with this code, u make zoom and the focus works at same time, if u make only a click fo make focus it give zoom o_O
 
Top