1# 窗口子系统Changelog
2
3## cl.display.1 屏幕Display对象rotation和orientation属性变更
4
5**访问级别**
6
7公开接口
8
9**变更原因**
10
11手机、平板等不同设备,电子器件贴片方向具有差异,传感器自然方向与屏幕的物理方向具有偏差,导致平板上屏幕Display对象中的rotation和orientation属性的返回值与手机不统一。
12手机和平板旋转同样的角度,用户从屏幕Display对象中的rotation和orientation获取的值不一致,常给用户带来困扰,需要针对设备类型做特殊处理,影响使用。
13
14**变更影响**
15
16该变更为不兼容变更。 <br>
17变更后平板上获取屏幕的横竖屏状态时,方向会与更改前不同,与手机保持一致。
18变更前后对比效果,如下图所示:
19| 设备旋转方向 | 平板变更前 | 平板变更后 |  手机 |
20|---------|---------|---------|---------|
21| ![](figures/0.PNG) | rotation: 1 <br> orientation: 0 | rotation: 0 <br> orientation: 0  | rotation: 0 <br> orientation: 0  |
22| ![](figures/90.PNG) | rotation: 2 <br> orientation: 3 | rotation: 1 <br> orientation: 1 |rotation: 1 <br> orientation: 1 |
23| ![](figures/180.PNG) | rotation: 3 <br> orientation:  2| rotation: 2 <br> orientation: 2 | rotation: 2 <br> orientation: 2 |
24| ![](figures/270.PNG) | rotation: 0 <br> orientation: 1 | rotation: 3 <br> orientation: 3 | rotation: 3 <br> orientation: 3 |
25
26**起始API Level**
27
28API 7
29
30**变更发生版本**
31
32从OpenHarmony SDK 5.0.2.1 版本开始。
33
34**变更的接口/组件**
35
36@ohos.display.d.ts文件中屏幕Display对象的rotation和orientation属性。
37
38
39
40**适配指导**
41
42平板上监听横竖屏状态变更:<br>
43业务方通过display.on('change')监听屏幕属性变化,从Display对象获取的rotation、orientation值。业务方如果在平板上判断rotation、orientation是否为某个横竖屏状态再处理相应业务,需要注意该值的变更。<br>
44以充电口朝下方向(此时rotation为0)为准,顺时针旋转0、90、180、270度,平板设备上对应的rotation和orientation对照表如下所示:
45|顺时针旋转角度|rotation变更前  | rotation变更后    | orientation变更前  | orientation变更后 |
46|-------      |-------        | --------          | ---------------   |---------------   |
47|0            |1              |  0                |  0                |0                 |
48|90           |2              |  1                |  3                |1                 |
49|180          |3              |  2                |  2                |2                 |
50|270          |0              |  3                |  1                |3                 |