@compass-framework/core 1.2.57 → 1.2.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { Consumer } from "@compass-framework/library";
2
2
  import { Context } from "./Context";
3
3
  import { RendererBackend } from "./RendererBackend";
4
+ import { Window } from "./Window";
4
5
  import { InputMethodService } from "./InputMethodService";
5
6
 
6
7
  /**
@@ -11,42 +11,107 @@ import { DisplayMetrics } from "./DisplayMetrics";
11
11
  * 可绘制对象的基类,封装边界、透明度与绘制回调。
12
12
  */
13
13
  export declare abstract class Drawable {
14
+ /**
15
+ * 使用运行时上下文构造 Drawable。
16
+ */
14
17
  protected constructor(context: Context);
15
18
 
19
+ /**
20
+ * 将当前内容绘制到指定画布。
21
+ */
16
22
  public abstract draw(canvas: Canvas): void;
17
23
 
24
+ /**
25
+ * 设置整体透明度,取值范围为 0–255。
26
+ */
18
27
  public abstract setAlpha(alpha: number): void;
19
28
 
29
+ /**
30
+ * 返回当前不透明度。
31
+ */
20
32
  public abstract getOpacity(): number;
21
33
 
34
+ /**
35
+ * 设备或主题等配置变化时回调。
36
+ */
22
37
  public onConfigurationChanged(newConfig: Configuration): void;
23
38
 
39
+ /**
40
+ * 边界矩形变化时回调。
41
+ */
24
42
  public onBoundsChange(bounds: Rect): void;
25
43
 
44
+ /**
45
+ * 屏幕密度变化时回调。
46
+ */
26
47
  public onDensityChanged(newConfig: Configuration): void;
27
48
 
49
+ /**
50
+ * 复制并返回当前边界矩形。
51
+ */
28
52
  public copyBounds() : Rect;
53
+ /**
54
+ * 将当前边界复制到指定矩形。
55
+ */
29
56
  public copyBounds(bounds: Rect): void;
30
57
 
58
+ /**
59
+ * 返回建议的最小宽度。
60
+ */
31
61
  public getMinimumWidth(): number;
32
62
 
63
+ /**
64
+ * 返回建议的最小高度。
65
+ */
33
66
  public getMinimumHeight(): number;
34
67
 
68
+ /**
69
+ * 返回当前绘制边界矩形。
70
+ */
35
71
  public getBounds(): Rect;
36
72
 
73
+ /**
74
+ * 返回关联的运行时上下文。
75
+ */
76
+ public getContext(): Context;
77
+
78
+ /**
79
+ * 将外形轮廓写入指定 Outline。
80
+ */
37
81
  public getOutline(outline:Outline):void;
38
82
 
83
+ /**
84
+ * 返回当前失效与调度回调。
85
+ */
39
86
  public getCallback() :Drawable.Callback;
40
87
 
88
+ /**
89
+ * 返回固有宽度;未知时为 -1。
90
+ */
41
91
  public getIntrinsicWidth(): number;
42
92
 
93
+ /**
94
+ * 返回固有高度;未知时为 -1。
95
+ */
43
96
  public getIntrinsicHeight():number;
44
97
 
98
+ /**
99
+ * 返回当前显示度量。
100
+ */
45
101
  public getDisplayMetrics(): DisplayMetrics;
46
102
 
103
+ /**
104
+ * 使用矩形设置绘制边界。
105
+ */
47
106
  public setBounds(bounds: Rect): void;
107
+ /**
108
+ * 使用左、上、右、下坐标设置绘制边界。
109
+ */
48
110
  public setBounds(left: number, top: number, right: number, bottom: number): void;
49
111
 
112
+ /**
113
+ * 设置失效与调度回调。
114
+ */
50
115
  public setCallback(callback: Drawable.Callback): void;
51
116
  }
52
117
 
@@ -58,10 +123,19 @@ export declare namespace Drawable {
58
123
  * Drawable 的不可变常量状态,用于创建新实例。
59
124
  */
60
125
  export abstract class ConstantState {
126
+ /**
127
+ * 基于常量状态创建新的 Drawable。
128
+ */
61
129
  public abstract newDrawable(): Drawable;
62
130
 
131
+ /**
132
+ * 使用指定资源创建新的 Drawable。
133
+ */
63
134
  public newResourcesDrawable(res: Resources): Drawable;
64
135
 
136
+ /**
137
+ * 返回会影响该状态的配置变更掩码。
138
+ */
65
139
  public abstract getChangingConfigurations(): number;
66
140
  }
67
141
 
@@ -69,12 +143,24 @@ export declare namespace Drawable {
69
143
  * Drawable 失效与调度回调接口。
70
144
  */
71
145
  export interface Callback {
146
+ /**
147
+ * 通知宿主指定 Drawable 需要重绘。
148
+ */
72
149
  invalidateDrawable(who:Drawable): void
73
150
 
151
+ /**
152
+ * 在指定时间调度 Drawable 的回调。
153
+ */
74
154
  scheduleDrawable(who: Drawable, what: Runnable, when: number): void
75
155
 
156
+ /**
157
+ * 取消已调度的 Drawable 回调。
158
+ */
76
159
  unScheduleDrawable(who: Drawable, what: Runnable): void
77
160
 
161
+ /**
162
+ * 返回宿主关联的资源管理器。
163
+ */
78
164
  getResources(): Resources;
79
165
  }
80
166
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compass-framework/core",
3
- "version": "1.2.57",
3
+ "version": "1.2.59",
4
4
  "description": "@compass-framework/core public api",
5
5
  "types": "./index.d.ts",
6
6
  "main": "./index.js",