Skip to content

Commit fb786a6

Browse files
committed
Rename ScreenObjectSnapshot.frame -> .size
1 parent 1c5b1ad commit fb786a6

File tree

3 files changed

+12
-36
lines changed

3 files changed

+12
-36
lines changed

haishinkit/src/main/java/com/haishinkit/screen/ScreenObjectFactory.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class ScreenObjectFactory {
3434
}.apply {
3535
layoutMargin.set(snapshot.layoutMargin)
3636
frame.set(
37-
snapshot.frame.x,
38-
snapshot.frame.y,
39-
snapshot.frame.x + snapshot.frame.width,
40-
snapshot.frame.y + snapshot.frame.height,
37+
0,
38+
0,
39+
snapshot.size.width,
40+
snapshot.size.height,
4141
)
4242
verticalAlignment = snapshot.verticalAlignment
4343
horizontalAlignment = snapshot.horizontalAlignment

haishinkit/src/main/java/com/haishinkit/screen/scene/ScreenObjectSnapshot.kt

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import kotlinx.serialization.Serializable
2020
* @property id
2121
* The unique identifier of this screen object.
2222
*
23-
* @property frame
23+
* @property size
2424
* The position and size of the screen object within its parent coordinate space.
2525
*
2626
* @property isVisible
@@ -46,37 +46,17 @@ import kotlinx.serialization.Serializable
4646
data class ScreenObjectSnapshot(
4747
val type: String,
4848
val id: String,
49-
val frame: Rect,
49+
val size: Size,
5050
val isVisible: Boolean,
5151
val layoutMargin: EdgeInsets,
5252
val horizontalAlignment: Int,
5353
val verticalAlignment: Int,
5454
val elements: Map<String, String>,
5555
val children: List<ScreenObjectSnapshot>,
5656
) {
57-
/**
58-
* Represents a rectangular frame of a screen object.
59-
*
60-
* The rectangle is defined using integer coordinates and dimensions
61-
* relative to the parent screen object.
62-
*
63-
* @property x
64-
* The x-coordinate of the top-left corner.
65-
*
66-
* @property y
67-
* The y-coordinate of the top-left corner.
68-
*
69-
* @property width
70-
* The width of the rectangle.
71-
*
72-
* @property height
73-
* The height of the rectangle.
74-
*/
7557
@Serializable
76-
data class Rect(
77-
val x: Int,
78-
val y: Int,
58+
data class Size(
7959
val width: Int,
80-
val height: Int,
60+
val height: Int
8161
)
8262
}

haishinkit/src/main/java/com/haishinkit/screen/scene/ScreenObjectSnapshotFactory.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ class ScreenObjectSnapshotFactory {
1010
ScreenObjectSnapshot(
1111
type = screenObject.type,
1212
id = screenObject.id,
13-
frame =
14-
ScreenObjectSnapshot.Rect(
15-
screenObject.frame.top,
16-
screenObject.frame.left,
13+
size =
14+
ScreenObjectSnapshot.Size(
1715
screenObject.frame.width(),
1816
screenObject.frame.height(),
1917
),
@@ -33,10 +31,8 @@ class ScreenObjectSnapshotFactory {
3331
ScreenObjectSnapshot(
3432
type = screenObject.type,
3533
id = screenObject.id,
36-
frame =
37-
ScreenObjectSnapshot.Rect(
38-
screenObject.frame.top,
39-
screenObject.frame.left,
34+
size =
35+
ScreenObjectSnapshot.Size(
4036
screenObject.frame.width(),
4137
screenObject.frame.height(),
4238
),

0 commit comments

Comments
 (0)