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();
$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', [
'panorama_type' => $panorama_type,
'title' => $block->dataValue('title'),
'title' => $title,
'width' => $width,
'height' => $height,
'autoLoad' => $block->dataValue('autoLoad'),
@ -109,7 +110,6 @@ class PanoramaViewer extends AbstractBlockLayout
'mediaTypes' => $media_types,
'thumbnails' => $thumbnails,
'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;">
<?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>
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<div class="archive-item pannellum-wrap">
<?php if ($panorama_type == "video") { ?>
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<video id="<?= $id ?>"
class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="none"
@ -50,13 +51,9 @@
</p>
</video>
<?php } else { ?>
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<div id="<?= $id ?>" class="panorama-viewer"></div>
<?php } ?>
<?php if ($title) { ?>
<div class="item_title">
<?= $title ?>
@ -64,8 +61,9 @@
<?php } ?>
</div>
<script>
</div>
<script>
<?php if ($panorama_type == "equirectangular") { ?>
pannellum.viewer("<?= $id ?>", {
type: "equirectangular",
@ -86,21 +84,15 @@
autoLoad: <?= json_encode($autoLoad == false ? false : true) ?>,
panorama: "<?= $urls[0]; ?>",
haov: 149.87,
vaov: 54.15,
vOffset: 1.17
vaov: 54.15,
vOffset: 1.17
});
<?php } ?>
<?php if ($panorama_type == "video") { ?>
videojs("<?= $id ?>", {
plugins: {
pannellum: {}
}
plugins: {
pannellum: {}
}
});
<?php } ?>
<?php if ($title !== false): ?>
$('#pannellum-ui').append('<?= $title ?>');
<?php endif ?>
</script>
</div>
</script>