adds ratio otion

This commit is contained in:
buttle 2021-10-06 13:13:35 +02:00
parent 101a016e9e
commit ae13afa445
4 changed files with 17 additions and 0 deletions

View File

@ -28,6 +28,11 @@ class Module extends AbstractModule
'100' => '100 %',
];
const RATIO = [
'2' => '2:1',
'1.333' => '4:3',
'1.777' => '16:9'
];
public function getConfig()
{

View File

@ -24,6 +24,7 @@ return [
'renderSourceLink' => true,
//'addPreLoadImage' => true,
'width' => 600,
'ratio' => '1.333',
'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;',
'ui_background' => 'rgba(0,0,0,0.1)',
]

View File

@ -29,6 +29,15 @@ class Render3DBlockForm extends Form
],
]);
$this->add([
'name' => 'o:block[__blockIndex__][o:data][ratio]',
'type' => Element\Select::class,
'options' => [
'label' => 'Ratio',
'value_options' => Module::RATIO,
],
]);
$this->add([
'type' => Element\Checkbox::class,
'name' => 'o:block[__blockIndex__][o:data][renderSourceLink]',

View File

@ -50,6 +50,7 @@ class Render3D extends AbstractBlockLayout
'o:block[__blockIndex__][o:data][model_type]' => $data['model_type'],
'o:block[__blockIndex__][o:data][title]' => $data['title'],
'o:block[__blockIndex__][o:data][width]' => $data['width'],
'o:block[__blockIndex__][o:data][ratio]' => $data['ratio'],
'o:block[__blockIndex__][o:data][renderSourceLink]' => $data['renderSourceLink'],
//'o:block[__blockIndex__][o:data][addPreLoadImage]' => $data['addPreLoadImage'],
]);
@ -101,6 +102,7 @@ class Render3D extends AbstractBlockLayout
'model_type' => $model_type,
'title' => $block->dataValue('title'),
'width' => $width,
'ratio' => $block->dataValue('ratio'),
'height' => $height,
'item_url' => $attachments[0]->item()->url(),
'renderSourceLink' => $block->dataValue('renderSourceLink'),