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.2

168

es/elements/Pannellum.js

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

import propTypes from "prop-types";
import React, { PureComponent } from "react";
import "../pannellum/css/pannellum.css";
import "../pannellum/css/style-textInfo.css";
import propTypes from 'prop-types';
import React, { Component } 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 (_PureComponent) {
_inherits(Pannellum, _PureComponent);
var Pannellum = (_temp = _class = function (_Component) {
_inherits(Pannellum, _Component);

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

var _this = _possibleConstructorReturn(this, _PureComponent.call(this, props));
var _this = _possibleConstructorReturn(this, _Component.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,21 +37,22 @@ 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" }
});

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

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

@@ -93,8 +91,6 @@ 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,
onRender: _this.props.onRender
hotSpots: hotspotArray
};

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

});
// 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.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 = 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);
};

@@ -134,10 +141,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);

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

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

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

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);
}
Pannellum.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
this.renderImage("update");
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

videojs.registerPlugin('pannellum', function (config) {
videojs.plugin('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 (_PureComponent) {
_inherits(Pannellum, _PureComponent);
var Pannellum = (_temp = _class = function (_Component) {
_inherits(Pannellum, _Component);

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

var _this = _possibleConstructorReturn(this, _PureComponent.call(this, props));
var _this = _possibleConstructorReturn(this, _Component.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,21 +53,22 @@ 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" }
});

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

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

@@ -109,8 +107,6 @@ 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,
onRender: _this.props.onRender
hotSpots: hotspotArray
};

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

});
// 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.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 = 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);
};

@@ -150,10 +157,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);

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

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

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

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);
}
Pannellum.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
this.renderImage("update");
};

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

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

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

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

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

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

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

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

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

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

@@ -277,5 +259,2 @@ 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,

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

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

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

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

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

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

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

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

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

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

@@ -30,4 +30,2 @@ "main": "lib/index.js",

"babel-eslint": "^10.0.1",
"codecov.io": "^0.1.6",
"coveralls": "^3.0.3",
"enzyme": "^3.3.0",

@@ -34,0 +32,0 @@ "enzyme-adapter-react-16": "^1.1.1",

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