fix funny typos in computeMasonryLayout

This commit is contained in:
celestora 2022-12-11 19:41:29 +02:00
parent c566c7e402
commit 37696673bf

View file

@ -30,7 +30,7 @@ class Makima
return Makima::ORIENT_SLIM; return Makima::ORIENT_SLIM;
} }
private function calculateMultiThumbsHeight(array $ratios, float $w, float $h, float $m): float private function calculateMultiThumbsHeight(array $ratios, float $w, float $m): float
{ {
return ($w - (sizeof($ratios) - 1) * $m) / array_sum($ratios); return ($w - (sizeof($ratios) - 1) * $m) / array_sum($ratios);
} }
@ -212,7 +212,7 @@ class Makima
# Now let's find the most optimal configuration: # Now let's find the most optimal configuration:
$optimalConfiguration = $optimalDifference = NULL; $optimalConfiguration = $optimalDifference = NULL;
foreach($tries as $config => $heights) { foreach($tries as $config => $heights) {
$config = explode('&', $config); $config = explode('&', (string) $config); # да да стринговые ключи пхп даже со стриктайпами автокастует к инту (см. 187)
$confH = $marginHeight * (sizeof($heights) - 1); $confH = $marginHeight * (sizeof($heights) - 1);
foreach($heights as $h) foreach($heights as $h)
$confH += $h; $confH += $h;
@ -241,8 +241,8 @@ class Makima
$gridLineOffsets = []; $gridLineOffsets = [];
$rowTiles = []; // vector<vector<ThumbTile>> $rowTiles = []; // vector<vector<ThumbTile>>
for($i = 0; $i < sizeof($optConf); $i++) { for($i = 0; $i < sizeof($optimalConfiguration); $i++) {
$lineChunksNum = $optConf[$i]; $lineChunksNum = $optimalConfiguration[$i];
$lineThumbs = []; $lineThumbs = [];
for($j = 0; $j < $lineChunksNum; $j++) for($j = 0; $j < $lineChunksNum; $j++)
$lineThumbs[] = array_shift($thumbsRemain); $lineThumbs[] = array_shift($thumbsRemain);