Implement bounds padding option.

This commit is contained in:
David Molineus
2016-10-11 14:32:43 +02:00
parent 17e7bc5e1c
commit 28490a9ee6
5 changed files with 43 additions and 4 deletions

View File

@@ -180,6 +180,17 @@ class MapMapper extends AbstractMapper
$map->setOption('adjustBounds', true);
}
if ($model->boundsPadding) {
$value = array_map('intval', explode(',', $model->boundsPadding, 4));
if (count($value) === 4) {
$map->setOption('boundsPaddingTopLeft', [$value[0], $value[1]]);
$map->setOption('boundsPaddingBottomRight', [$value[2], $value[3]]);
} elseif (count($value) === 2) {
$map->setOption('boundsPadding', $value);
}
}
if (in_array('load', $adjustBounds)) {
$map->calculateFeatureBounds();
}