Lines Matching refs:r
208 lv_indev_gesture_recognizer_t * r = recognizer; in lv_indev_gesture_detect_pinch() local
211 if(r->info == NULL) { in lv_indev_gesture_detect_pinch()
213 r->info = init_gesture_info(); in lv_indev_gesture_detect_pinch()
216 if(r->config == NULL) { in lv_indev_gesture_detect_pinch()
218 r->config = lv_malloc(sizeof(lv_indev_gesture_configuration_t)); in lv_indev_gesture_detect_pinch()
220 LV_ASSERT(r->config != NULL); in lv_indev_gesture_detect_pinch()
222 r->config->pinch_up_threshold = LV_GESTURE_PINCH_UP_THRESHOLD; in lv_indev_gesture_detect_pinch()
223 r->config->pinch_down_threshold = LV_GESTURE_PINCH_DOWN_THRESHOLD; in lv_indev_gesture_detect_pinch()
230 process_touch_event(touch, r->info); in lv_indev_gesture_detect_pinch()
234 … i, touch->id, touch->state, touch->point.x, touch->point.y, r->info->finger_cnt); in lv_indev_gesture_detect_pinch()
237 LV_LOG_TRACE("Current finger count: %d state: %d", r->info->finger_cnt, r->state); in lv_indev_gesture_detect_pinch()
240 if(r->info->finger_cnt == 2) { in lv_indev_gesture_detect_pinch()
242 switch(r->state) { in lv_indev_gesture_detect_pinch()
249 gesture_update_center_point(r->info, 2); in lv_indev_gesture_detect_pinch()
250 r->state = LV_INDEV_GESTURE_STATE_ONGOING; in lv_indev_gesture_detect_pinch()
257 gesture_calculate_factors(r->info, 2); in lv_indev_gesture_detect_pinch()
259 if(r->info->scale > LV_GESTURE_PINCH_MAX_INITIAL_SCALE && in lv_indev_gesture_detect_pinch()
260 r->state == LV_INDEV_GESTURE_STATE_ONGOING) { in lv_indev_gesture_detect_pinch()
261 r->state = LV_INDEV_GESTURE_STATE_CANCELED; in lv_indev_gesture_detect_pinch()
265 LV_ASSERT(r->config != NULL); in lv_indev_gesture_detect_pinch()
267 if(r->info->scale > r->config->pinch_up_threshold || in lv_indev_gesture_detect_pinch()
268 r->info->scale < r->config->pinch_down_threshold) { in lv_indev_gesture_detect_pinch()
270 if(r->info->scale > 1.0f) { in lv_indev_gesture_detect_pinch()
271 r->scale = r->info->scale - (r->config->pinch_up_threshold - 1.0f); in lv_indev_gesture_detect_pinch()
274 else if(r->info->scale < 1.0f) { in lv_indev_gesture_detect_pinch()
276 r->scale = r->info->scale + (1.0f - r->config->pinch_down_threshold); in lv_indev_gesture_detect_pinch()
279 r->type = LV_INDEV_GESTURE_PINCH; in lv_indev_gesture_detect_pinch()
280 r->state = LV_INDEV_GESTURE_STATE_RECOGNIZED; in lv_indev_gesture_detect_pinch()
291 switch(r->state) { in lv_indev_gesture_detect_pinch()
294 r->state = LV_INDEV_GESTURE_STATE_ENDED; in lv_indev_gesture_detect_pinch()
295 r->type = LV_INDEV_GESTURE_PINCH; in lv_indev_gesture_detect_pinch()
300 r->state = LV_INDEV_GESTURE_STATE_CANCELED; in lv_indev_gesture_detect_pinch()
301 reset_recognizer(r); in lv_indev_gesture_detect_pinch()
306 reset_recognizer(r); in lv_indev_gesture_detect_pinch()