123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <template>
- <div class="view-setting" app-border dir-left>
- <div class="title">
- {{ $i18n.t("screen.init_screen") }}
- <i
- class="iconfont icon-help_i tool-tip-for-editor"
- v-tooltip="$i18n.t('screen.screen_tips')"
- />
- </div>
- <template v-if="currentScene.type !== '4dkk'">
- <img
- class="preview"
- v-if="initImg"
- :src="`${initImg}?${Math.random()}`"
- alt=""
- />
- <img
- class="placeholder"
- v-else
- src="@/assets/images/pano-image-placeholder.png"
- alt=""
- />
- <div class="item">
- <div class="">垂直视角限制</div>
- <slider v-model="vlookat" range show-stops :min="-90" :max="90">
- </slider>
- </div>
- <div class="col">
- <span>应用到全部全景图</span>
- <Switcher :value="applyToAll" @change="onSwitcherChange"></Switcher>
- </div>
- </template>
- <div class="goto-4dkk-tip" v-if="currentScene.type === '4dkk'">
- <div class="img-wrap">
- <img
- class=""
- src="@/assets/images/default/goto-4dage.png"
- alt=""
- draggable="false"
- />
- <div class="tip-text">
- {{ $i18n.t("screen.goto_4dkk_edit_tips") }}
- </div>
- </div>
- <button class="ui-button submit" @click="onClickGo4dkk">
- {{ $i18n.t("navigation.go_scene_editor") }}
- </button>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import { Slider } from "element-ui";
- import Switcher from "@/components/shared/Switcher";
- export default {
- components: {
- Slider,
- Switcher,
- },
- computed: {
- ...mapGetters({
- currentScene: "scene/currentScene",
- }),
- },
- data() {
- return {
- initImg: "",
- vlookat: null,
- applyToAll: false,
- };
- },
- watch: {
- "currentScene.initVisual": {
- handler(val) {
- const { vlookatmin, vlookatmax } = val;
- if (vlookatmin && vlookatmax) {
- this.vlookat = [vlookatmin, vlookatmax];
- }
- },
- deep: true,
- immediate: true,
- },
- vlookat: {
- handler: function (val) {
- this.handleVlootAt(val);
- },
- },
- },
- methods: {
- onClickGo4dkk() {
- window.open("/#/scene");
- },
- onSwitcherChange(value) {
- this.applyToAll = value;
- },
- handleVlootAt(val) {
- if (val) {
- const min = Math.min(...val);
- const max = Math.max(...val);
- this.currentScene.initVisual.vlookatmin = min;
- this.currentScene.initVisual.vlookatmax = max;
- this.handleKrAction(min, max);
- }
- },
- handleKrAction(min, max) {
- const kr = this.$getKrpano();
- if (kr) {
- kr.set("view.limitview", "lookat");
- const mid = min + max;
- kr.set("view.vlookat", mid);
- kr.set("view.vlookatmin", String(min));
- kr.set("view.vlookatmax", String(max));
- }
- },
- },
- mounted() {
- this.$bus.on("initView", (data) => {
- this.initImg = data;
- });
- if (!this.initImg) {
- this.initImg = this.currentScene.icon;
- }
- },
- };
- </script>
- <style lang="less" scoped>
- .view-setting {
- padding: 20px;
- > .title {
- font-size: 18px;
- color: #fff;
- margin-bottom: 16px;
- > i {
- font-size: 12px;
- position: relative;
- top: -2px;
- }
- }
- .preview {
- width: 100%;
- height: 132px;
- border-radius: 4px;
- margin-bottom: 16px;
- object-fit: cover;
- image-rendering: smooth;
- }
- .placeholder {
- width: 100%;
- height: 132px;
- margin-bottom: 16px;
- }
- .item {
- .el-slider {
- padding: 0 5px;
- }
- }
- .col {
- width: 100%;
- margin: 15px 0;
- display: inline-flex;
- justify-content: space-between;
- align-items: center;
- }
- .goto-4dkk-tip {
- > .img-wrap {
- position: relative;
- width: 100%;
- > .img {
- width: 100%;
- }
- > .tip-text {
- position: absolute;
- left: 50%;
- bottom: 32px;
- transform: translateX(-50%);
- font-size: 14px;
- color: #fff;
- opacity: 0.6;
- white-space: pre;
- }
- }
- > button {
- margin-top: 16px;
- width: 100%;
- }
- }
- }
- </style>
|