0

I would like to rotate my watches display to a variable degree like a compass does in real life? So far I have only discovered this function within the samsung API

screen.lockOrientation("portrait-secondary");

I would like more control than this, if that means using the native API, that's fine but I need help on where to look.

Bob Saget
  • 67
  • 2
  • 8
  • Hi @Bob Saget, did my answer help you? No response from you till now. – Shaswati Saha Sep 03 '18 at 03:21
  • Yes I think this will work, I was having trouble understanding the map concept but it looks like the function takes inputs that will allow me to rotate on the x axis to a variable degree. Thank you, I wouldn't have found this. – Bob Saget Sep 04 '18 at 16:04

1 Answers1

1

You may try using evas_map_util_rotate() function to rotate an object. It rotates the map based on an angle and the center coordinates of the rotation (the rotation point). A positive angle rotates the map clockwise, while a negative angle rotates the map counter-clockwise.

Please have a look into Modifying a Map with Utility Functions section of this link. It contains an example which shows how to rotate an object around its center point by 45 degrees clockwise.

You may also use below sample code snippet.

 @param[in] object_to_rotate The object you want to rotate
 @param[in] degree The degree you want to rotate
 @param[in] cx The rotation's center horizontal position
 @param[in] cy The rotation's center vertical position

void view_rotate_object(Evas_Object *object_to_rotate, double degree, Evas_Coord cx, Evas_Coord cy)
{
    Evas_Map *m = NULL;

    if (object_to_rotate == NULL) {
        dlog_print(DLOG_ERROR, LOG_TAG, "object  is NULL");
        return;
    }

    m = evas_map_new(4);
    evas_map_util_points_populate_from_object(m, object_to_rotate);
    evas_map_util_rotate(m, degree, cx, cy);
    evas_object_map_set(object_to_rotate, m);
    evas_object_map_enable_set(object_to_rotate, EINA_TRUE);
    evas_map_free(m);
}

Hope it'll help.

Shaswati Saha
  • 758
  • 5
  • 15