Skip to content

Commit

Permalink
Fixed spacing of linear layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
smilefx committed Oct 18, 2024
1 parent 2407b00 commit 369514a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion bgw-gui/src/jsMain/kotlin/tools/aqua/bgw/Animator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class Animator {
}
.${componentId}--${type} {
translate: ${animationData.byX}rem ${animationData.byY}rem;
translate: ${animationData.byX}em ${animationData.byY}em;
}
""".trimIndent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ val LinearLayout = FC<LinearLayoutProps> { props ->
for(i in 1 until it.childElementCount) {
val child = it.children[i] as HTMLElement
if(props.data.orientation == "vertical") {
child.style.marginTop = "${props.data.spacing}rem"
child.style.marginTop = "${props.data.spacing}em"
child.style.marginLeft = "0"
} else {
child.style.marginLeft = "${props.data.spacing}rem"
child.style.marginLeft = "${props.data.spacing}em"
child.style.marginTop = "0"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ val ReactGridPane = FC<GridPaneProps> { props ->
val height = element.offsetHeight / rem
val x = (props.data.posX - width / 2)
val y = (props.data.posY - height / 2)
element.style.left = "${x}rem"
element.style.top = "${y}rem"
element.style.left = "${x}em"
element.style.top = "${y}em"
}
}
} else {
useEffect(listOf(props.data)) {
document.getElementById(props.data.id)?.let {
it.style.left = "${props.data.posX}rem"
it.style.top = "${props.data.posY}rem"
it.style.left = "${props.data.posX}em"
it.style.top = "${props.data.posY}em"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/style/Filter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BlurFilter(radius: Double) : FilterDeclaration {

init {
value = if (radius > 0.0)
"${radius}rem"
"${radius}em"
else
null
}
Expand Down
24 changes: 12 additions & 12 deletions bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/style/Style.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ interface StyleDeclaration {
}

class BorderRadius : StyleDeclaration {
var topLeft: String = "0rem"
var topRight: String = "0rem"
var bottomRight: String = "0rem"
var bottomLeft: String = "0rem"
var topLeft: String = "0em"
var topRight: String = "0em"
var bottomRight: String = "0em"
var bottomLeft: String = "0em"

constructor(radius: Int) {
topLeft = "${radius}rem"
topRight = "${radius}rem"
bottomRight = "${radius}rem"
bottomLeft = "${radius}rem"
topLeft = "${radius}em"
topRight = "${radius}em"
bottomRight = "${radius}em"
bottomLeft = "${radius}em"
}

constructor(topLeft: Int, topRight: Int, bottomRight: Int, bottomLeft: Int) {
this.topLeft = "${topLeft}rem"
this.topRight = "${topRight}rem"
this.bottomRight = "${bottomRight}rem"
this.bottomLeft = "${bottomLeft}rem"
this.topLeft = "${topLeft}em"
this.topRight = "${topRight}em"
this.bottomRight = "${bottomRight}em"
this.bottomLeft = "${bottomLeft}em"
}

constructor(radius: String) : this(radius, radius, radius, radius)
Expand Down

0 comments on commit 369514a

Please sign in to comment.