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,40 +1,41 @@
<?php
$this->headLink()->appendStylesheet($this->assetUrl('vendor/pannellum/pannellum.css',
'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js',
'PanoramaViewer'));
if ($panorama_type == "video") {
$this->headLink()->appendStylesheet($this->assetUrl('vendor/video.js/video-js.css',
'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('vendor/video.js/video.js',
'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/videojs-pannellum-plugin.js',
'PanoramaViewer'));
}
if ($title !== false && $title !== "") {
$title = sprintf('<p id="panorama-viewer-title">%s</p>', $title);
} else {
$title = false;
}
?>
<style>
#<?= $id ?> {
height: <?= $height ?>px;
width: <?= $width ?>px;
}
</style>
<div class="pannemmul-wrap" style="position:relative;"> <div class="pannemmul-wrap" style="position:relative;">
<?php <?php if ($renderSourceLink) { ?>
$this->headLink()->appendStylesheet($this->assetUrl('vendor/pannellum/pannellum.css', <div class="source-link">
'PanoramaViewer')); <a href="<?= $item_url ?>">Source</a>
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/pannellum.js', </div>
'PanoramaViewer')); <?php } ?>
if ($panorama_type == "video") {
$this->headLink()->appendStylesheet($this->assetUrl('vendor/video.js/video-js.css',
'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('vendor/video.js/video.js',
'PanoramaViewer'));
$this->headScript()->appendFile($this->assetUrl('vendor/pannellum/videojs-pannellum-plugin.js',
'PanoramaViewer'));
}
if ($title !== false && $title !== "") {
$title = sprintf('<p id="panorama-viewer-title">%s</p>', $title);
} else {
$title = false;
}
?>
<style>
#<?= $id ?> {
height: <?= $height ?>px;
width: <?= $width ?>px;
}
</style>
<div class="archive-item pannellum-wrap"> <div class="archive-item pannellum-wrap">
<?php if ($panorama_type == "video") { ?> <?php if ($panorama_type == "video") { ?>
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<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",
@ -86,21 +84,15 @@
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>, autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
panorama: "<?= $urls[0]; ?>", panorama: "<?= $urls[0]; ?>",
haov: 149.87, haov: 149.87,
vaov: 54.15, vaov: 54.15,
vOffset: 1.17 vOffset: 1.17
}); });
<?php } ?> <?php } ?>
<?php if ($panorama_type == "video") { ?> <?php if ($panorama_type == "video") { ?>
videojs("<?= $id ?>", { videojs("<?= $id ?>", {
plugins: { plugins: {
pannellum: {} pannellum: {}
} }
}); });
<?php } ?> <?php } ?>
</script>
<?php if ($title !== false): ?>
$('#pannellum-ui').append('<?= $title ?>');
<?php endif ?>
</script>
</div>