Compare commits

..

2 Commits

Author SHA1 Message Date
buttle ae13afa445 adds ratio otion 2021-10-06 13:13:35 +02:00
buttle 101a016e9e adds width option in percentage 2021-10-06 13:04:26 +02:00
4 changed files with 29 additions and 7 deletions

View File

@ -22,6 +22,18 @@ class Module extends AbstractModule
*/
];
const MODEL_WIDTH = [
'50' => '50 %',
'75' => '75 %',
'100' => '100 %',
];
const RATIO = [
'2' => '2:1',
'1.333' => '4:3',
'1.777' => '16:9'
];
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';

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

@ -22,12 +22,19 @@ class Render3DBlockForm extends Form
$this->add([
'name' => 'o:block[__blockIndex__][o:data][width]',
'type' => Element\Number::class,
'type' => Element\Select::class,
'options' => [
'label' => 'Width in pixels',
'label' => 'Width',
'value_options' => Module::MODEL_WIDTH,
],
'attributes' => [
'min' => '100',
]);
$this->add([
'name' => 'o:block[__blockIndex__][o:data][ratio]',
'type' => Element\Select::class,
'options' => [
'label' => 'Ratio',
'value_options' => Module::RATIO,
],
]);

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'),