Compare commits

..

No commits in common. "d0674ff108da00615e93804230e7c680887438ad" and "e35f30afa44e57a01b3bd60af506e763092e9752" have entirely different histories.

4 changed files with 12 additions and 20 deletions

View File

@ -1,6 +0,0 @@
function get_height(container, ratio) {
//console.log($(container).width(), ratio)
var height = $(container).width() / ratio
//console.log(height)
return height
}

View File

@ -20,20 +20,17 @@ class PanoramaViewerBlockForm 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\Number::class,
'options' => [ 'options' => [
'label' => 'Width in percentage', 'label' => 'Width in pixels',
], ],
'attributes' => [ 'attributes' => [
'min' => '50', 'min' => '100',
'max' => '100',
], ],
]); ]);
*/
$this->add([ $this->add([
'name' => 'o:block[__blockIndex__][o:data][ratio]', 'name' => 'o:block[__blockIndex__][o:data][ratio]',
'type' => Element\Select::class, 'type' => Element\Select::class,

View File

@ -95,10 +95,14 @@ class PanoramaViewer extends AbstractBlockLayout
} }
$item_id = $attachments[0]->item()->url(); $item_id = $attachments[0]->item()->url();
//$title = $attachments[0]->item()->title(); //$title = $attachments[0]->item()->title();
$title = $block->dataValue('title');
$width = $block->dataValue('width');
$height = $width / $block->dataValue('ratio');
return $view->partial('common/block-layout/panorama-viewer', [ return $view->partial('common/block-layout/panorama-viewer', [
'panorama_type' => $panorama_type, 'panorama_type' => $panorama_type,
'title' => $block->dataValue('title'), 'title' => $title,
'ratio' => $block->dataValue('ratio'), 'width' => $width,
'height' => $height,
'autoLoad' => $block->dataValue('autoLoad'), 'autoLoad' => $block->dataValue('autoLoad'),
'renderSourceLink' => $block->dataValue('renderSourceLink'), 'renderSourceLink' => $block->dataValue('renderSourceLink'),
'urls' => $urls, 'urls' => $urls,

View File

@ -3,8 +3,6 @@
'PanoramaViewer')); 'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js', $this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js',
'PanoramaViewer')); 'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
'PanoramaViewer'));
if ($panorama_type == "video") { if ($panorama_type == "video") {
$this->headLink()->appendStylesheet($this->assetUrl('vendor/video.js/video-js.css', $this->headLink()->appendStylesheet($this->assetUrl('vendor/video.js/video-js.css',
@ -22,8 +20,9 @@
?> ?>
<style> <style>
.pannemmul-wrap { #<?= $id ?> {
width: 100%; height: <?= $height ?>px;
width: <?= $width ?>px;
} }
</style> </style>
@ -96,6 +95,4 @@
} }
}); });
<?php } ?> <?php } ?>
var height = get_height('#<?= $id ?>', <?= $ratio ?>)
$('#<?= $id ?>').css('height', height)
</script> </script>