首页 > 解决方案 > 如何将手表显示屏旋转到可变角度?

问题描述

我想像现实生活中的指南针一样将手表显示屏旋转到可变角度?到目前为止,我只在 samsung API 中发现了这个函数

screen.lockOrientation("portrait-secondary");

我想要比这更多的控制,如果这意味着使用本机 API,那很好,但我需要关于在哪里查看的帮助。

标签: samsung-mobiletizentizen-wearable-sdktizen-native-app

解决方案


您可以尝试使用evas_map_util_rotate()函数来旋转对象。它根据角度和旋转的中心坐标(旋转点)旋转地图。正角使地图顺时针旋转,而负角使地图逆时针旋转。

请查看此链接的使用实用功能修改地图部分。它包含一个示例,该示例显示如何将对象围绕其中心点顺时针旋转 45 度。

您也可以使用下面的示例代码片段。

 @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);
}

希望它会有所帮助。


推荐阅读