Procházet zdrojové kódy

Handle case where only one of `horizonRoll` / `horizonPitch` is defined (see #402).

pull/846/head
Matthew Petroff před 4 roky
rodič
revize
862cd450e5
2 změnil soubory, kde provedl 16 přidání a 6 odebrání
  1. +1
    -1
      COPYING
  2. +15
    -5
      src/js/libpannellum.js

+ 1
- 1
COPYING Zobrazit soubor

@@ -1,4 +1,4 @@
Copyright (c) 2011-2019 Matthew Petroff
Copyright (c) 2011-2020 Matthew Petroff

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in


+ 15
- 5
src/js/libpannellum.js Zobrazit soubor

@@ -1,6 +1,6 @@
/*
* libpannellum - A WebGL and CSS 3D transform based Panorama Renderer
* Copyright (c) 2012-2019 Matthew Petroff
* Copyright (c) 2012-2020 Matthew Petroff
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -311,9 +311,12 @@ function Renderer(container) {
}

// Store horizon pitch and roll if applicable
if (params !== undefined && (params.horizonPitch !== undefined || params.horizonRoll !== undefined))
pose = [params.horizonPitch == undefined ? 0 : params.horizonPitch,
params.horizonRoll == undefined ? 0 : params.horizonRoll];
if (params !== undefined) {
var horizonPitch = isNaN(params.horizonPitch) ? 0 : Number(params.horizonPitch),
horizonRoll = isNaN(params.horizonRoll) ? 0 : Number(params.horizonRoll);
if (horizonPitch != 0 || horizonRoll != 0)
pose = [horizonPitch, horizonRoll];
}

// Set 2d texture binding
var glBindType = gl.TEXTURE_2D;
@@ -563,9 +566,16 @@ function Renderer(container) {
* Set renderer horizon pitch and roll.
* @memberof Renderer
* @instance
* @param {number} horizonPitch - Pitch of horizon (in radians).
* @param {number} horizonRoll - Roll of horizon (in radians).
*/
this.setPose = function(horizonPitch, horizonRoll) {
pose = [horizonPitch, horizonRoll];
horizonPitch = isNaN(horizonPitch) ? 0 : Number(horizonPitch);
horizonRoll = isNaN(horizonRoll) ? 0 : Number(horizonRoll);
if (horizonPitch == 0 && horizonRoll == 0)
pose = undefined;
else
pose = [horizonPitch, horizonRoll];
};

/**


Načítá se…
Zrušit
Uložit