1.5.3 • Published 7 years ago

vue-krpano v1.5.3

Weekly downloads
57
License
ISC
Repository
github
Last release
7 years ago

Somewhats

vue-krpano

A Vue component for krpano player.

Demo

https://www.somewhats.cn/pois/10045

https://itunes.apple.com/cn/app/%E5%A3%B9%E4%BA%8C/id1190188895?l=en&mt=8

Installation

npm install vue-krpano --save

Dependency

  • vuejs@2.0
  • A Krpano player globally referenced by <script>

Example

Install the component

import Vue from "vue";
import Krpano from "vue-krpano";


Vue.use(Krpano);

Use the component

<krpano :xml="'krpano.xml'" :lazy-load="true" style="width:100%;height:400px" @panoCreated="init"></krpano>

Props

NameDescriptionExample
xmlKrpano configuration XML pathkrpano.xml
sceneScene namefoo
lazyLoadA Boolean setting to lazy load pano objectstrue
freezeVerticalA Boolean setting to freeze scrolling verticallyfalse
hooksAn object that will be attached to the krpano instance{foo:bar}
debugDebug modefalse

Krpano builtin options

NameDescriptionExample
bgcolorThe background color of the viewer (in html color format).#000000
wmodeThe wmode setting is typically a Flashplayer setting, but wmode=opaque and wmode=transparent will be evaluated also by the krpano HTML5 viewer and make the viewer background transparent there too. Overlapping html elements itself are always possible when using the HTML5 viewer.opaque
varsPass a Javascript Object with krpano variable:value pairs.The variables will be set AFTER the xml file has been be loaded and parsed.So these variables can be used to add new settings or to overwrite settings that were already defined in the xml.
initvarsPass a Javascript Object with krpano variable:value pairs.This is basically the same as the vars setting, but these variables will be set BEFORE the xml file wil be loaded and parsed.
basepathCan be used in Flash and HTML5 for adjusting relative paths in the xml.
mwheelA Boolean setting to control the mouse-wheel usagefalse
focusA Boolean setting to give the viewer the input / keyboard focus on startup.true
consolelogA Boolean setting that defines if krpano log/trace-messages should be sent also to the browser Javascript console.false
webglsettingsPass an object with special settings for the WebGL context creation.The WebGL context will be created at startup and can't be changed at runtime, therefore these settings need to be specified already during embedding.
mobilescaleBy default all krpano content on mobile devices will be scaled by 0.5.To disable that scaling, set the mobilescale setting to 1.0.This can be useful for implementing responsive webdesigns.0.5
fakedeviceFake the krpano device detection settings.Available settings: mobile, tablet, desktop.mobile

Events

panoCreated

This event will be fired along with a krpano object as soon as the krpano instance is successfully initialized.

sceneChanged

This event will be fired every time the scene is changed. The scene name will also be involved.

Two-way Communication

The hooks object will be attached to the krpano instance.

Example:

The Vue component wants to capture the event when user click the route spot in pano scenes.

<script>
    export default {
        data(){
            const vm = this;
            return {
                xml: "xml path",
                scene: "scene name",
                hooks:{
                    sceneChanged(scene){
                        //event handler
                    }
                }                
            }
        }
    }
</script>
<template>
    <krpano :xml="xml" :scene="scene" :hooks="hooks"></krpano>
</template>

In krpano scripts, you can access the callback object via krpano instance.

<events name="player_listener" keep="true" onnewscene="on_scene_loaded()"/>
<action name="on_scene_loaded">
    jscall(calc('krpano.hooks.sceneChanged("' + scene[get(xml.scene)].name + '")'));
</action>

About

For any question, please feel free to write email to chshapple@gmail.com

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.4

7 years ago

1.4.3

7 years ago

1.4.2

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago