fixes layout

This commit is contained in:
buttle 2021-06-27 16:15:17 +02:00
parent 74a0c3e8ca
commit 569b21ad1d
2 changed files with 45 additions and 53 deletions

View File

@ -94,12 +94,13 @@ 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'); $width = $block->dataValue('width');
$height = $width / $block->dataValue('ratio'); $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,
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
'autoLoad' => $block->dataValue('autoLoad'), 'autoLoad' => $block->dataValue('autoLoad'),
@ -109,7 +110,6 @@ class PanoramaViewer extends AbstractBlockLayout
'mediaTypes' => $media_types, 'mediaTypes' => $media_types,
'thumbnails' => $thumbnails, 'thumbnails' => $thumbnails,
'item_url' => $attachments[0]->item()->url(), 'item_url' => $attachments[0]->item()->url(),
'item_title' => $attachments[0]->item()->title(),
]); ]);
} }
} }

View File

@ -1,6 +1,4 @@
<div class="pannemmul-wrap" style="position:relative;"> <?php
<?php
$this->headLink()->appendStylesheet($this->assetUrl('vendor/pannellum/pannellum.css', $this->headLink()->appendStylesheet($this->assetUrl('vendor/pannellum/pannellum.css',
'PanoramaViewer')); 'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js', $this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js',
@ -19,22 +17,25 @@
} else { } else {
$title = false; $title = false;
} }
?> ?>
<style> <style>
#<?= $id ?> { #<?= $id ?> {
height: <?= $height ?>px; height: <?= $height ?>px;
width: <?= $width ?>px; width: <?= $width ?>px;
} }
</style> </style>
<div class="pannemmul-wrap" style="position:relative;">
<div class="archive-item pannellum-wrap">
<?php if ($panorama_type == "video") { ?>
<?php if ($renderSourceLink) { ?> <?php if ($renderSourceLink) { ?>
<div class="source-link"> <div class="source-link">
<a href="<?= $item_url ?>">Source</a> <a href="<?= $item_url ?>">Source</a>
</div> </div>
<?php } ?> <?php } ?>
<div class="archive-item pannellum-wrap">
<?php if ($panorama_type == "video") { ?>
<video id="<?= $id ?>" <video id="<?= $id ?>"
class="video-js vjs-default-skin vjs-big-play-centered" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="none" controls preload="none"
@ -50,13 +51,9 @@
</p> </p>
</video> </video>
<?php } else { ?> <?php } else { ?>
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<div id="<?= $id ?>" class="panorama-viewer"></div> <div id="<?= $id ?>" class="panorama-viewer"></div>
<?php } ?> <?php } ?>
<?php if ($title) { ?> <?php if ($title) { ?>
<div class="item_title"> <div class="item_title">
<?= $title ?> <?= $title ?>
@ -64,8 +61,9 @@
<?php } ?> <?php } ?>
</div> </div>
<script> </div>
<script>
<?php if ($panorama_type == "equirectangular") { ?> <?php if ($panorama_type == "equirectangular") { ?>
pannellum.viewer("<?= $id ?>", { pannellum.viewer("<?= $id ?>", {
type: "equirectangular", type: "equirectangular",
@ -97,10 +95,4 @@
} }
}); });
<?php } ?> <?php } ?>
</script>
<?php if ($title !== false): ?>
$('#pannellum-ui').append('<?= $title ?>');
<?php endif ?>
</script>
</div>