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() public function getConfig()
{ {
return include __DIR__ . '/config/module.config.php'; return include __DIR__ . '/config/module.config.php';

View File

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

View File

@ -22,13 +22,20 @@ class Render3DBlockForm extends Form
$this->add([ $this->add([
'name' => 'o:block[__blockIndex__][o:data][width]', 'name' => 'o:block[__blockIndex__][o:data][width]',
'type' => Element\Number::class, 'type' => Element\Select::class,
'options' => [ '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,
],
]); ]);
$this->add([ $this->add([

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