Skip to content

Commit

Permalink
Merge branch 'main' into androidsupport
Browse files Browse the repository at this point in the history
  • Loading branch information
biezhihua committed Jul 28, 2022
2 parents 5dd0e6d + ad0450a commit 152930f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ sealed class GXSize {
}

fun Float.ptToPx(): Float {
val ratio = GXScreenUtils.getScreenWidthDP(GXTemplateEngine.instance.context) / 375F
GXRegisterCenter.instance.extensionSize?.convert(ratio)?.let { newRatio ->
return this.dpToPx().roundToInt().toFloat() * Math.min(1.3F, Math.max(newRatio, 1F))
val screenWidthDP = GXScreenUtils.getScreenWidthDP(GXTemplateEngine.instance.context)
val dpToPx = 375F.dpToPx()
var ratio = screenWidthDP / dpToPx
GXRegisterCenter.instance.extensionSize?.convert(ratio)?.let {
ratio = it
}
return this.dpToPx().roundToInt().toFloat() * Math.min(1.3F, Math.max(ratio, 1F))
return this.dpToPx().roundToInt().toFloat() * Math.max(ratio, 1F)
}

private fun String.replacePxToEmpty(): String {
Expand Down

0 comments on commit 152930f

Please sign in to comment.