File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
media-placeholders/src/main/java/org/wordpress/aztec/placeholders Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -392,7 +392,12 @@ class PlaceholderManager(
392392 } else {
393393 height.ratio
394394 }
395- (ratio * calculateWidth(attrs, windowWidth)).toInt()
395+ val result = (ratio * calculateWidth(attrs, windowWidth)).toInt()
396+ if (height.limit != null && height.limit < result) {
397+ height.limit
398+ } else {
399+ result
400+ }
396401 }
397402 }
398403 }
@@ -411,15 +416,20 @@ class PlaceholderManager(
411416 width.ratio > 1.0 -> 1.0f
412417 else -> width.ratio
413418 }
414- (safeRatio * windowWidth).toInt()
419+ val result = (safeRatio * windowWidth).toInt()
420+ if (width.limit != null && result > width.limit) {
421+ width.limit
422+ } else {
423+ result
424+ }
415425 }
416426 }
417427 }
418428 }
419429
420430 sealed class Proportion {
421- data class Fixed (val value : Int ) : Proportion()
422- data class Ratio (val ratio : Float ) : Proportion()
431+ data class Fixed (val value : Int , val limit : Int? = null ) : Proportion()
432+ data class Ratio (val ratio : Float , val limit : Int? = null ) : Proportion()
423433 }
424434 }
425435
You can’t perform that action at this time.
0 commit comments