[TIZENIOT-1794] Correcting slider event area calculation for minicontroller 90/245290/1
authoraman.jeph <aman.jeph@samsung.com>
Tue, 6 Oct 2020 11:44:36 +0000 (17:14 +0530)
committeraman.jeph <aman.jeph@samsung.com>
Tue, 6 Oct 2020 11:44:36 +0000 (17:14 +0530)
Change-Id: Ibad67d0af4e9d3dc45a35ce6a4cc28bebe4d030d
Signed-off-by: aman.jeph <aman.jeph@samsung.com>
src/minictrl/minictrl.c

index b5288971386767794e77bedca129ad29b9a2d1b9..ef6017701c0e11efeb228f2cc321c52078016b14 100755 (executable)
 #define MINCONTROL_CONTAINER_SWALLOW "mini_ctrl.swallow"
 
 //SLIDER AREA
-#define SLIDER_START_W 790
-#define SLIDER_END_W 1160
-#define SLIDER_START_H 400
-#define SLIDER_END_H 432
+#define SLIDER_START_W 790 // start postion of slider with respect to window
+#define SLIDER_END_W 1160  // end position of slider with respect to window
+#define SLIDER_EVENT_AREA 32
+#define SLIDER_LAYOUT_HEIGHT 112
+#define SLIDER_START_H_OFFSET  (((SLIDER_LAYOUT_HEIGHT) - (SLIDER_EVENT_AREA))/2) // offset for slider height start with respect to viewer layout
+#define SLIDER_END_H_OFFSET (SLIDER_START_H_OFFSET + SLIDER_EVENT_AREA) // offset for slider height end with respect to viewer layout
 
 //Max Size of Mini-Controller
 #define MINICONTROL_MAX_WIDTH 1200
@@ -242,8 +244,17 @@ static void _mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_in
         *  co-ordinate provided by the mouse event are relative to window/screen.
         *  if position of slider object is changed than we need to update slider area accordingly.
         */
+       int x = 0, y = 0, w = 0, h = 0;
+       evas_object_geometry_get(obj, &x, &y, &w, &h);
+       DBG("Viewer [X: %d] [Y: %d] [W: %d] [H: %d]", x, y, w, h);
+       DBG("Mouse click [X: %d] [Y: %d]", ev->canvas.x, ev->canvas.y);
+
+       int slider_start_h = y + SLIDER_START_H_OFFSET;
+       int slider_end_h = y + SLIDER_END_H_OFFSET;
+
+       DBG("Height range: [start: %d] [end: %d]", slider_start_h, slider_end_h);
 
-       if(ev->canvas.x >= SLIDER_START_W && ev->canvas.x <= SLIDER_END_W && ev->canvas.y >= SLIDER_START_H && ev->canvas.y <= SLIDER_END_H)
+       if(ev->canvas.x >= SLIDER_START_W && ev->canvas.x <= SLIDER_END_W && ev->canvas.y >= slider_start_h && ev->canvas.y <= slider_end_h)
        {
                s_info.mouse_event_blocker = EINA_TRUE;
                elm_object_scroll_freeze_push(ad->scroller);