New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pannellum-react

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pannellum-react - npm Package Compare versions

Comparing version

to
1.2.3

168

es/elements/Pannellum.js

@@ -9,13 +9,13 @@ var _class, _temp;

import propTypes from 'prop-types';
import React, { Component } from 'react';
import '../pannellum/css/pannellum.css';
import '../pannellum/css/style-textInfo.css';
import propTypes from "prop-types";
import React, { PureComponent } from "react";
import "../pannellum/css/pannellum.css";
import "../pannellum/css/style-textInfo.css";
import '../pannellum/js/libpannellum.js';
import '../pannellum/js/pannellum.js';
import '../pannellum/js/RequestAnimationFrame';
import "../pannellum/js/libpannellum.js";
import "../pannellum/js/pannellum.js";
import "../pannellum/js/RequestAnimationFrame";
var Pannellum = (_temp = _class = function (_Component) {
_inherits(Pannellum, _Component);
var Pannellum = (_temp = _class = function (_PureComponent) {
_inherits(Pannellum, _PureComponent);

@@ -25,7 +25,7 @@ function Pannellum(props) {

var _this = _possibleConstructorReturn(this, _Component.call(this, props));
var _this = _possibleConstructorReturn(this, _PureComponent.call(this, props));
_this.renderImage = function (state) {
var children = _this.props.children;
// make the array of sub components, even if its one, it become array of one
// make the array of sub components, even if its one, it become array of one

@@ -37,22 +37,21 @@ var hotspots = [].concat(children);

switch (hotspot.props.type) {
case "info":
return hotspotArray.push({
"id": Math.random().toString(36).substr(2, 9),
"type": hotspot.props.type,
"pitch": hotspot.props.pitch ? hotspot.props.pitch : 10,
"yaw": hotspot.props.yaw ? hotspot.props.yaw : 10,
"text": hotspot.props.text ? hotspot.props.text : "",
"URL": hotspot.props.URL ? hotspot.props.URL : ""
id: Math.random().toString(36).substr(2, 9),
type: hotspot.props.type,
pitch: hotspot.props.pitch ? hotspot.props.pitch : 10,
yaw: hotspot.props.yaw ? hotspot.props.yaw : 10,
text: hotspot.props.text ? hotspot.props.text : "",
URL: hotspot.props.URL ? hotspot.props.URL : ""
});
case "custom":
return hotspotArray.push({
"id": Math.random().toString(36).substr(2, 9),
"pitch": hotspot.props.pitch ? hotspot.props.pitch : 10,
"yaw": hotspot.props.yaw ? hotspot.props.yaw : 10,
"cssClass": hotspot.props.cssClass ? hotspot.props.cssClass : 'tooltipcss',
"createTooltipFunc": hotspot.props.tooltip ? hotspot.props.tooltip : _this.hotspotTooltip,
"createTooltipArgs": hotspot.props.tooltipArg ? hotspot.props.tooltipArg : {},
"clickHandlerFunc": hotspot.props.handleClick ? hotspot.props.handleClick : _this.handleClickHotspot,
"clickHandlerArgs": hotspot.props.handleClickArg ? hotspot.props.handleClickArg : { name: "test" }
id: Math.random().toString(36).substr(2, 9),
pitch: hotspot.props.pitch ? hotspot.props.pitch : 10,
yaw: hotspot.props.yaw ? hotspot.props.yaw : 10,
cssClass: hotspot.props.cssClass ? hotspot.props.cssClass : "tooltipcss",
createTooltipFunc: hotspot.props.tooltip ? hotspot.props.tooltip : _this.hotspotTooltip,
createTooltipArgs: hotspot.props.tooltipArg ? hotspot.props.tooltipArg : {},
clickHandlerFunc: hotspot.props.handleClick ? hotspot.props.handleClick : _this.handleClickHotspot,
clickHandlerArgs: hotspot.props.handleClickArg ? hotspot.props.handleClickArg : { name: "test" }
});

@@ -68,2 +67,5 @@ default:

panorama: _this.props.image,
haov: _this.props.haov,
vaov: _this.props.vaov,
vOffset: _this.props.vOffset,
yaw: _this.props.yaw,

@@ -91,6 +93,8 @@ pitch: _this.props.pitch,

draggable: _this.props.draggable,
disableKeyboardCtrl: _this.props.disableKeyboardCtrl,
showFullscreenCtrl: _this.props.showFullscreenCtrl,
showControls: _this.props.showControls,
hotSpotDebug: _this.props.hotspotDebug,
hotSpots: hotspotArray
hotSpots: hotspotArray,
onRender: _this.props.onRender
};

@@ -101,29 +105,18 @@

});
// this.setState({ jsonConfig });
if (state === "update") {
_this.panorama.destroy();
_this.panorama = pannellum.viewer(_this.props.id ? _this.props.id : _this.state.id, jsonConfig);
_this.panorama.on("load", _this.props.onLoad);
_this.panorama.on("scenechange", _this.props.onScenechange);
_this.panorama.on("scenechangefadedone", _this.props.onScenechangefadedone);
_this.panorama.on("error", _this.props.onError);
_this.panorama.on("errorcleared", _this.props.onErrorcleared);
_this.panorama.on("mousedown", _this.props.onMousedown);
_this.panorama.on("mouseup", _this.props.onMouseup);
_this.panorama.on("touchstart", _this.props.onTouchstart);
_this.panorama.on("touchend", _this.props.onTouchend);
} else {
_this.panorama = pannellum.viewer(_this.props.id ? _this.props.id : _this.state.id, jsonConfig);
}
_this.panorama = pannellum.viewer(_this.props.id ? _this.props.id : _this.state.id, jsonConfig);
_this.panorama.on("load", _this.props.onLoad);
_this.panorama.on("scenechange", _this.props.onScenechange);
_this.panorama.on("scenechangefadedone", _this.props.onScenechangefadedone);
_this.panorama.on("error", _this.props.onError);
_this.panorama.on("errorcleared", _this.props.onErrorcleared);
_this.panorama.on("mousedown", _this.props.onMousedown);
_this.panorama.on("mouseup", _this.props.onMouseup);
_this.panorama.on("touchstart", _this.props.onTouchstart);
_this.panorama.on("touchend", _this.props.onTouchend);
}
_this.panorama.on("load", _this.props.onLoad);
_this.panorama.on("scenechange", _this.props.onScenechange);
_this.panorama.on("scenechangefadedone", _this.props.onScenechangefadedone);
_this.panorama.on("error", _this.props.onError);
_this.panorama.on("errorcleared", _this.props.onErrorcleared);
_this.panorama.on("mousedown", _this.props.onMousedown);
_this.panorama.on("mouseup", _this.props.onMouseup);
_this.panorama.on("touchstart", _this.props.onTouchstart);
_this.panorama.on("touchend", _this.props.onTouchend);
};

@@ -141,10 +134,10 @@

hotSpotDiv.setAttribute("id", "textInfo");
var hDiv = document.createElement('div');
hDiv.classList.add('hotspot');
var outDiv = document.createElement('div');
outDiv.classList.add('out');
var inDiv = document.createElement('div');
inDiv.classList.add('in');
var imageDiv = document.createElement('div');
imageDiv.classList.add('image');
var hDiv = document.createElement("div");
hDiv.classList.add("hotspot");
var outDiv = document.createElement("div");
outDiv.classList.add("out");
var inDiv = document.createElement("div");
inDiv.classList.add("in");
var imageDiv = document.createElement("div");
imageDiv.classList.add("image");
hotSpotDiv.appendChild(hDiv);

@@ -159,2 +152,6 @@ hDiv.appendChild(inDiv);

_this.forceRender = function () {
_this.renderImage("update");
};
_this.state = {

@@ -166,4 +163,20 @@ id: Math.random().toString(36).substr(2, 9)

Pannellum.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
this.renderImage("update");
Pannellum.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) {
if (prevProps.image !== this.props.image || prevProps.width !== this.props.width || prevProps.height !== this.props.height || prevProps.compass !== this.props.compass || prevProps.title !== this.props.title || prevProps.author !== this.props.author || prevProps.preview !== this.props.preview || prevProps.previewTitle !== this.props.previewTitle || prevProps.previewAuthor !== this.props.previewAuthor || prevProps.showZoomCtrl !== this.props.showZoomCtrl || prevProps.showFullscreenCtrl !== this.props.showFullscreenCtrl || prevProps.showControls !== this.props.showControls || prevProps.children.length !== this.props.children.length) {
this.renderImage("update");
}
if (prevProps.maxYaw !== this.props.maxYaw || prevProps.minYaw !== this.props.minYaw || prevProps.maxPitch !== this.props.maxPitch || prevProps.minPitch !== this.props.minPitch || prevProps.maxHfov !== this.props.maxHfov || prevProps.minHfov !== this.props.minHfov) {
this.panorama.setYawBounds([this.props.minYaw, this.props.maxYaw]);
this.panorama.setPitchBounds([this.props.minPitch, this.props.maxPitch]);
this.panorama.setHfovBounds([this.props.minHfov, this.props.maxHfov]);
}
if (prevProps.yaw !== this.props.yaw) {
this.panorama.setYaw(this.props.yaw);
}
if (prevProps.pitch !== this.props.pitch) {
this.panorama.setPitch(this.props.pitch);
}
if (prevProps.hfov !== this.props.hfov) {
this.panorama.setHfov(this.props.hfov);
}
};

@@ -182,3 +195,3 @@

};
return React.createElement('div', {
return React.createElement("div", {
id: this.props.id ? this.props.id : this.state.id,

@@ -193,7 +206,10 @@ style: divStyle,

return Pannellum;
}(Component), _class.defaultProps = {
}(PureComponent), _class.defaultProps = {
children: [],
width: '100%',
height: '400px',
image: '',
width: "100%",
height: "400px",
image: "",
haov: 360,
vaov: 180,
vOffset: 0,
yaw: 0,

@@ -210,7 +226,7 @@ pitch: 0,

compass: false,
preview: '',
previewTitle: '',
previewAuthor: '',
title: '',
author: '',
preview: "",
previewTitle: "",
previewAuthor: "",
title: "",
author: "",
autoLoad: false,

@@ -222,2 +238,3 @@ orientationOnByDefault: false,

draggable: true,
disableKeyboardCtrl: false,
showFullscreenCtrl: true,

@@ -234,3 +251,4 @@ showControls: true,

onTouchend: function onTouchend() {},
hotspotDebug: false
hotspotDebug: false,
onRender: null
}, _temp);

@@ -243,2 +261,5 @@ Pannellum.propTypes = process.env.NODE_ENV !== "production" ? {

image: propTypes.string,
haov: propTypes.number,
vaov: propTypes.number,
vOffset: propTypes.number,
yaw: propTypes.number,

@@ -266,2 +287,3 @@ pitch: propTypes.number,

draggable: propTypes.bool,
disableKeyboardCtrl: propTypes.bool,
showFullscreenCtrl: propTypes.bool,

@@ -283,4 +305,4 @@ showControls: propTypes.bool,

handleClickArg: propTypes.object,
cssClass: propTypes.string
cssClass: propTypes.string,
onRender: propTypes.func
} : {};

@@ -287,0 +309,0 @@

@@ -11,3 +11,3 @@ /*

videojs.plugin('pannellum', function (config) {
videojs.registerPlugin('pannellum', function (config) {
// Create Pannellum instance

@@ -14,0 +14,0 @@ var player = this;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,19 +7,19 @@ exports.__esModule = true;

var _propTypes = require('prop-types');
var _propTypes = require("prop-types");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react = require("react");
var _react2 = _interopRequireDefault(_react);
require('../pannellum/css/pannellum.css');
require("../pannellum/css/pannellum.css");
require('../pannellum/css/style-textInfo.css');
require("../pannellum/css/style-textInfo.css");
require('../pannellum/js/libpannellum.js');
require("../pannellum/js/libpannellum.js");
require('../pannellum/js/pannellum.js');
require("../pannellum/js/pannellum.js");
require('../pannellum/js/RequestAnimationFrame');
require("../pannellum/js/RequestAnimationFrame");

@@ -34,4 +34,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Pannellum = (_temp = _class = function (_Component) {
_inherits(Pannellum, _Component);
var Pannellum = (_temp = _class = function (_PureComponent) {
_inherits(Pannellum, _PureComponent);

@@ -41,7 +41,7 @@ function Pannellum(props) {

var _this = _possibleConstructorReturn(this, _Component.call(this, props));
var _this = _possibleConstructorReturn(this, _PureComponent.call(this, props));
_this.renderImage = function (state) {
var children = _this.props.children;
// make the array of sub components, even if its one, it become array of one
// make the array of sub components, even if its one, it become array of one

@@ -53,22 +53,21 @@ var hotspots = [].concat(children);

switch (hotspot.props.type) {
case "info":
return hotspotArray.push({
"id": Math.random().toString(36).substr(2, 9),
"type": hotspot.props.type,
"pitch": hotspot.props.pitch ? hotspot.props.pitch : 10,
"yaw": hotspot.props.yaw ? hotspot.props.yaw : 10,
"text": hotspot.props.text ? hotspot.props.text : "",
"URL": hotspot.props.URL ? hotspot.props.URL : ""
id: Math.random().toString(36).substr(2, 9),
type: hotspot.props.type,
pitch: hotspot.props.pitch ? hotspot.props.pitch : 10,
yaw: hotspot.props.yaw ? hotspot.props.yaw : 10,
text: hotspot.props.text ? hotspot.props.text : "",
URL: hotspot.props.URL ? hotspot.props.URL : ""
});
case "custom":
return hotspotArray.push({
"id": Math.random().toString(36).substr(2, 9),
"pitch": hotspot.props.pitch ? hotspot.props.pitch : 10,
"yaw": hotspot.props.yaw ? hotspot.props.yaw : 10,
"cssClass": hotspot.props.cssClass ? hotspot.props.cssClass : 'tooltipcss',
"createTooltipFunc": hotspot.props.tooltip ? hotspot.props.tooltip : _this.hotspotTooltip,
"createTooltipArgs": hotspot.props.tooltipArg ? hotspot.props.tooltipArg : {},
"clickHandlerFunc": hotspot.props.handleClick ? hotspot.props.handleClick : _this.handleClickHotspot,
"clickHandlerArgs": hotspot.props.handleClickArg ? hotspot.props.handleClickArg : { name: "test" }
id: Math.random().toString(36).substr(2, 9),
pitch: hotspot.props.pitch ? hotspot.props.pitch : 10,
yaw: hotspot.props.yaw ? hotspot.props.yaw : 10,
cssClass: hotspot.props.cssClass ? hotspot.props.cssClass : "tooltipcss",
createTooltipFunc: hotspot.props.tooltip ? hotspot.props.tooltip : _this.hotspotTooltip,
createTooltipArgs: hotspot.props.tooltipArg ? hotspot.props.tooltipArg : {},
clickHandlerFunc: hotspot.props.handleClick ? hotspot.props.handleClick : _this.handleClickHotspot,
clickHandlerArgs: hotspot.props.handleClickArg ? hotspot.props.handleClickArg : { name: "test" }
});

@@ -84,2 +83,5 @@ default:

panorama: _this.props.image,
haov: _this.props.haov,
vaov: _this.props.vaov,
vOffset: _this.props.vOffset,
yaw: _this.props.yaw,

@@ -107,6 +109,8 @@ pitch: _this.props.pitch,

draggable: _this.props.draggable,
disableKeyboardCtrl: _this.props.disableKeyboardCtrl,
showFullscreenCtrl: _this.props.showFullscreenCtrl,
showControls: _this.props.showControls,
hotSpotDebug: _this.props.hotspotDebug,
hotSpots: hotspotArray
hotSpots: hotspotArray,
onRender: _this.props.onRender
};

@@ -117,29 +121,18 @@

});
// this.setState({ jsonConfig });
if (state === "update") {
_this.panorama.destroy();
_this.panorama = pannellum.viewer(_this.props.id ? _this.props.id : _this.state.id, jsonConfig);
_this.panorama.on("load", _this.props.onLoad);
_this.panorama.on("scenechange", _this.props.onScenechange);
_this.panorama.on("scenechangefadedone", _this.props.onScenechangefadedone);
_this.panorama.on("error", _this.props.onError);
_this.panorama.on("errorcleared", _this.props.onErrorcleared);
_this.panorama.on("mousedown", _this.props.onMousedown);
_this.panorama.on("mouseup", _this.props.onMouseup);
_this.panorama.on("touchstart", _this.props.onTouchstart);
_this.panorama.on("touchend", _this.props.onTouchend);
} else {
_this.panorama = pannellum.viewer(_this.props.id ? _this.props.id : _this.state.id, jsonConfig);
}
_this.panorama = pannellum.viewer(_this.props.id ? _this.props.id : _this.state.id, jsonConfig);
_this.panorama.on("load", _this.props.onLoad);
_this.panorama.on("scenechange", _this.props.onScenechange);
_this.panorama.on("scenechangefadedone", _this.props.onScenechangefadedone);
_this.panorama.on("error", _this.props.onError);
_this.panorama.on("errorcleared", _this.props.onErrorcleared);
_this.panorama.on("mousedown", _this.props.onMousedown);
_this.panorama.on("mouseup", _this.props.onMouseup);
_this.panorama.on("touchstart", _this.props.onTouchstart);
_this.panorama.on("touchend", _this.props.onTouchend);
}
_this.panorama.on("load", _this.props.onLoad);
_this.panorama.on("scenechange", _this.props.onScenechange);
_this.panorama.on("scenechangefadedone", _this.props.onScenechangefadedone);
_this.panorama.on("error", _this.props.onError);
_this.panorama.on("errorcleared", _this.props.onErrorcleared);
_this.panorama.on("mousedown", _this.props.onMousedown);
_this.panorama.on("mouseup", _this.props.onMouseup);
_this.panorama.on("touchstart", _this.props.onTouchstart);
_this.panorama.on("touchend", _this.props.onTouchend);
};

@@ -157,10 +150,10 @@

hotSpotDiv.setAttribute("id", "textInfo");
var hDiv = document.createElement('div');
hDiv.classList.add('hotspot');
var outDiv = document.createElement('div');
outDiv.classList.add('out');
var inDiv = document.createElement('div');
inDiv.classList.add('in');
var imageDiv = document.createElement('div');
imageDiv.classList.add('image');
var hDiv = document.createElement("div");
hDiv.classList.add("hotspot");
var outDiv = document.createElement("div");
outDiv.classList.add("out");
var inDiv = document.createElement("div");
inDiv.classList.add("in");
var imageDiv = document.createElement("div");
imageDiv.classList.add("image");
hotSpotDiv.appendChild(hDiv);

@@ -175,2 +168,6 @@ hDiv.appendChild(inDiv);

_this.forceRender = function () {
_this.renderImage("update");
};
_this.state = {

@@ -182,4 +179,20 @@ id: Math.random().toString(36).substr(2, 9)

Pannellum.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
this.renderImage("update");
Pannellum.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) {
if (prevProps.image !== this.props.image || prevProps.width !== this.props.width || prevProps.height !== this.props.height || prevProps.compass !== this.props.compass || prevProps.title !== this.props.title || prevProps.author !== this.props.author || prevProps.preview !== this.props.preview || prevProps.previewTitle !== this.props.previewTitle || prevProps.previewAuthor !== this.props.previewAuthor || prevProps.showZoomCtrl !== this.props.showZoomCtrl || prevProps.showFullscreenCtrl !== this.props.showFullscreenCtrl || prevProps.showControls !== this.props.showControls || prevProps.children.length !== this.props.children.length) {
this.renderImage("update");
}
if (prevProps.maxYaw !== this.props.maxYaw || prevProps.minYaw !== this.props.minYaw || prevProps.maxPitch !== this.props.maxPitch || prevProps.minPitch !== this.props.minPitch || prevProps.maxHfov !== this.props.maxHfov || prevProps.minHfov !== this.props.minHfov) {
this.panorama.setYawBounds([this.props.minYaw, this.props.maxYaw]);
this.panorama.setPitchBounds([this.props.minPitch, this.props.maxPitch]);
this.panorama.setHfovBounds([this.props.minHfov, this.props.maxHfov]);
}
if (prevProps.yaw !== this.props.yaw) {
this.panorama.setYaw(this.props.yaw);
}
if (prevProps.pitch !== this.props.pitch) {
this.panorama.setPitch(this.props.pitch);
}
if (prevProps.hfov !== this.props.hfov) {
this.panorama.setHfov(this.props.hfov);
}
};

@@ -198,3 +211,3 @@

};
return _react2.default.createElement('div', {
return _react2.default.createElement("div", {
id: this.props.id ? this.props.id : this.state.id,

@@ -209,7 +222,10 @@ style: divStyle,

return Pannellum;
}(_react.Component), _class.defaultProps = {
}(_react.PureComponent), _class.defaultProps = {
children: [],
width: '100%',
height: '400px',
image: '',
width: "100%",
height: "400px",
image: "",
haov: 360,
vaov: 180,
vOffset: 0,
yaw: 0,

@@ -226,7 +242,7 @@ pitch: 0,

compass: false,
preview: '',
previewTitle: '',
previewAuthor: '',
title: '',
author: '',
preview: "",
previewTitle: "",
previewAuthor: "",
title: "",
author: "",
autoLoad: false,

@@ -238,2 +254,3 @@ orientationOnByDefault: false,

draggable: true,
disableKeyboardCtrl: false,
showFullscreenCtrl: true,

@@ -250,3 +267,4 @@ showControls: true,

onTouchend: function onTouchend() {},
hotspotDebug: false
hotspotDebug: false,
onRender: null
}, _temp);

@@ -259,2 +277,5 @@ Pannellum.propTypes = process.env.NODE_ENV !== "production" ? {

image: _propTypes2.default.string,
haov: _propTypes2.default.number,
vaov: _propTypes2.default.number,
vOffset: _propTypes2.default.number,
yaw: _propTypes2.default.number,

@@ -282,2 +303,3 @@ pitch: _propTypes2.default.number,

draggable: _propTypes2.default.bool,
disableKeyboardCtrl: _propTypes2.default.bool,
showFullscreenCtrl: _propTypes2.default.bool,

@@ -299,4 +321,4 @@ showControls: _propTypes2.default.bool,

handleClickArg: _propTypes2.default.object,
cssClass: _propTypes2.default.string
cssClass: _propTypes2.default.string,
onRender: _propTypes2.default.func
} : {};

@@ -307,2 +329,2 @@

exports.default = Pannellum;
module.exports = exports['default'];
module.exports = exports["default"];

@@ -12,3 +12,3 @@ 'use strict';

videojs.plugin('pannellum', function (config) {
videojs.registerPlugin('pannellum', function (config) {
// Create Pannellum instance

@@ -15,0 +15,0 @@ var player = this;

{
"name": "pannellum-react",
"version": "1.2.2",
"version": "1.2.3",
"description": "Pannellum React Component",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet