首页 > 其他分享 >photo-sphere-viewer全景图使用案例

photo-sphere-viewer全景图使用案例

时间:2024-08-13 20:17:34浏览次数:4  
标签:false viewer photo sphere 全景图 import

1.安装photo-sphere-viewer,两种方式都可以

npm install @photo-sphere-viewer/core

yarn add @photo-sphere-viewer/core

2.项目中去引入 

import { Viewer } from 'photo-sphere-viewer'
import * as PhotoSphereViewer from "photo-sphere-viewer/dist/adapters/cubemap.js";
import { MarkersPlugin } from 'photo-sphere-viewer/dist/plugins/markers'
import { EquirectangularTilesAdapter } from "photo-sphere-viewer/dist/adapters/equirectangular-tiles"
import 'photo-sphere-viewer/dist/plugins/markers.css';

3.代码页面

viewdata.value = new Viewer({
            container: idname,//必填参数,放置全景图的div元素。
            adapter: EquirectangularTilesAdapter,//适配器
            
            // panorama: img,//必填参数,全景图的路径
            panorama: {
                width: 1200,
                cols: 16,//2的几次方
                rows: 8,//2的几次方
                baseUrl: `${img}/low.jpg`,//图片路径
                tileUrl: (col, row) => {
                    return `${img}/row-${col+1}-column-${row+1}.jpg`;//根据后台的图片规则去拼接路径
                },
            },
            autorotateDelay: false,//可选,默认值为true,true为自动调用全景图,false为在后面加载全景图(通过.load()方法)。
            size: {
                width: '100%',
                height: '100%'
            },
            maxFov: 100,//100,//可选,默认值为90,观察的最小区域,单位degrees,在1-179之间
            minFov: 50,//10,//可选,默认值为30,观察的最大区域,单位degrees,在1-179之间。
            navbar: false,//可选值,默认为false。显示导航条。
            touchmoveTwoFingers: false,
            mousewheelCtrlKey: false,
            autorotateSpeed:0,
            plugins: [
                [MarkersPlugin, {
                    markers: [ ],
                }],
            ],
        }).on('ready', function () {
             console.log('pano ok')
        })

4.每次切换的时候,先删除上一张

if (viewdata.value) try {
            const viewer = document.getElementById(idname)
            viewer.removeChild(viewer.childNodes[0])
        } catch (e) {
            // viewdata.value.destroy()
            // console.log(e)
        }

 文笔不好,自己做记录用的,有需要的可以拿去用

标签:false,viewer,photo,sphere,全景图,import
From: https://www.cnblogs.com/xiaoyang459/p/18357588

相关文章

  • shardingsphere5分表demo
    分表配置demodatabaseName:mydb#逻辑数据库名称dataSources:ds_0:url:jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useSSL=falseusername:rootpassword:rootconnectionTimeoutMilliseconds:30000idleTimeoutMil......
  • KubeSphere 部署 Kafka 集群实战指南
    本文档将详细阐述如何利用Helm这一强大的工具,快速而高效地在K8s集群上安装并配置一个Kafka集群。实战服务器配置(架构1:1复刻小规模生产环境,配置略有不同)主机名IPCPU内存系统盘数据盘用途ksp-registry192.168.9.904840200Harbor镜像仓库ksp-co......
  • 如何在DasViewer中把不同季节的模型调成一样的颜色?
    答:三维模型出现各种色差主要是因为原始照片色差造成的。比如外业航飞时的时间、季节、天气条件不一,相机的色调、清晰度、曝光等参数设置不同等,原始照片的色差会直接影响到后续三维模型的色彩表现,造成颜色不统一。为消除模型色差,需要对原始照片或者模型进行调色处理。针对图中......
  • 前端实现文档预览(支持word、ppt、pdf)-【@zuiyouliao/vue-file-viewer】
    背景有的时候我们需要在前端页面上预览某些文档,文档的格式比如:word、ppt、pdf、图片等等实现方案可以使用@zuiyouliao/vue-file-viewer第三方库,官方地址方式1:通过组件方式引入优点:word/图片可以识别,方便快捷。缺点:pdf/pptx文件无法识别。安装依赖npminstall--save@zui......
  • ShardingSphere之ShardingProxy实战操作、分布式事务
    文章目录简介基础使用部署ShardingProxy配置分库分表策略分布式事务机制介绍XA事务Demo使用另外两种XA事务管理器简介ShardingSphere的两个核心产品分别为ShardingJDBC和ShardingProxy。前文已经详细介绍了ShardingJDBC的具体使用,接下来介绍服务端的分库分表Shar......
  • ShardingSphere之ShardingProxy集群部署
    文章目录介绍使用Zookeeper进行集群部署统一ShardingJDBC和ShardingProxy配置通过Zookeeper注册中心同步配置直接使用ShardingProxy提供的JDBC驱动读取配置文件介绍开发者手册在conf/server.yaml配置文件中有下面这一段配置,就是关于集群部署的mode:#type:stan......
  • Reviewer Instructions
    ReviewerInstructionsAsanIP&Mreviewer,yourobjectiveistoevaluatethemeritsandpresentationoftheresearchpresentedinthissubmission.Submissionsshouldemployappropriatemethodsanddatathatsubstantiatestheconclusionsandinterpreta......
  • WPF ScrollViewer控件 触屏滑动
    备份下  原文 https://www.cnblogs.com/webenh/p/18207292<ScrollViewerx:Name="scroll"TouchDown="mScrollViewer_TouchDown"TouchMove="mScrollViewer_TouchMove"TouchUp="mScrollViewer_TouchUp"></ScrollViewer>......
  • KubeSphere 社区双周报| 2024.07.19-08.01
    KubeSphere社区双周报主要整理展示新增的贡献者名单和证书、新增的讲师证书以及两周内提交过commit的贡献者,并对近期重要的PR进行解析,同时还包含了线上/线下活动和布道推广等一系列社区动态。本次双周报涵盖时间为:2024.07.19-08.01。贡献者名单新晋KubeSpherecontribu......
  • VMware vSphere 8 Update 3 新增功能
    VMwarevSphere8Update3新增功能作者主页:sysin.orgvSphere8.0Update3已于2024-06-25发布,让我们先来了解一下其新增功能。VMwarevSphere8.0Update3下载-企业级工作负载平台又到了这个时候了!是时候对vSphere8进行另一次功能丰富的更新了。隆重推出vSphe......