Browse Source

BREAKING CHANGE! Reverse sign of hot spot yaw so it makes sense.

pull/58/merge
Matthew Petroff 9 years ago
parent
commit
f8dfee9d63
3 changed files with 9 additions and 9 deletions
  1. +2
    -2
      examples/example-cube.json
  2. +4
    -4
      examples/example-tour.json
  3. +3
    -3
      src/js/pannellum.js

+ 2
- 2
examples/example-cube.json View File

@@ -19,13 +19,13 @@
"hotSpots": [ "hotSpots": [
{ {
"pitch": -12, "pitch": -12,
"yaw": -170,
"yaw": 170,
"type": "info", "type": "info",
"text": "This is Jordan Pond, located in Acadia National Park." "text": "This is Jordan Pond, located in Acadia National Park."
}, },
{ {
"pitch": -10, "pitch": -10,
"yaw": 50,
"yaw": -50,
"type": "info", "type": "info",
"text": "This is a link.", "text": "This is a link.",
"URL": "https://github.com/mpetroff/pannellum" "URL": "https://github.com/mpetroff/pannellum"


+ 4
- 4
examples/example-tour.json View File

@@ -20,20 +20,20 @@
"hotSpots": [ "hotSpots": [
{ {
"pitch": -12, "pitch": -12,
"yaw": -170,
"yaw": 170,
"type": "info", "type": "info",
"text": "This is Jordan Pond, located in Acadia National Park." "text": "This is Jordan Pond, located in Acadia National Park."
}, },
{ {
"pitch": -10, "pitch": -10,
"yaw": 50,
"yaw": -50,
"type": "info", "type": "info",
"text": "This is a link.", "text": "This is a link.",
"URL": "https://github.com/mpetroff/pannellum" "URL": "https://github.com/mpetroff/pannellum"
}, },
{ {
"pitch": 0, "pitch": 0,
"yaw": 60,
"yaw": -60,
"type": "scene", "type": "scene",
"text": "Pond", "text": "Pond",
"sceneId": "pond" "sceneId": "pond"
@@ -47,7 +47,7 @@
"hotSpots": [ "hotSpots": [
{ {
"pitch": 0, "pitch": 0,
"yaw": -100,
"yaw": 100,
"type": "scene", "type": "scene",
"text": "Pond (cube)", "text": "Pond (cube)",
"sceneId": "pondCube" "sceneId": "pondCube"


+ 3
- 3
src/js/pannellum.js View File

@@ -1036,7 +1036,7 @@ function destroyHotSpots() {
function renderHotSpots() { function renderHotSpots() {
config.hotSpots.forEach(function(hs) { config.hotSpots.forEach(function(hs) {
var z = Math.sin(hs.pitch * Math.PI / 180) * Math.sin(config.pitch * Math.PI / var z = Math.sin(hs.pitch * Math.PI / 180) * Math.sin(config.pitch * Math.PI /
180) + Math.cos(hs.pitch * Math.PI / 180) * Math.cos((hs.yaw + config.yaw) *
180) + Math.cos(hs.pitch * Math.PI / 180) * Math.cos((-hs.yaw + config.yaw) *
Math.PI / 180) * Math.cos(config.pitch * Math.PI / 180); Math.PI / 180) * Math.cos(config.pitch * Math.PI / 180);
if ((hs.yaw <= 90 && hs.yaw > -90 && z <= 0) || if ((hs.yaw <= 90 && hs.yaw > -90 && z <= 0) ||
((hs.yaw > 90 || hs.yaw <= -90) && z <= 0)) { ((hs.yaw > 90 || hs.yaw <= -90) && z <= 0)) {
@@ -1046,13 +1046,13 @@ function renderHotSpots() {
// Subpixel rendering doesn't work in Firefox // Subpixel rendering doesn't work in Firefox
// https://bugzilla.mozilla.org/show_bug.cgi?id=739176 // https://bugzilla.mozilla.org/show_bug.cgi?id=739176
var transform = 'translate(' + (-renderer.canvas.width / var transform = 'translate(' + (-renderer.canvas.width /
Math.tan(config.hfov * Math.PI / 360) * Math.sin((hs.yaw +
Math.tan(config.hfov * Math.PI / 360) * Math.sin((-hs.yaw +
config.yaw) * Math.PI / 180) * Math.cos(hs.pitch * Math.PI / config.yaw) * Math.PI / 180) * Math.cos(hs.pitch * Math.PI /
180) / z / 2 + renderer.canvas.width / 2 - 13) + 'px, ' + 180) / z / 2 + renderer.canvas.width / 2 - 13) + 'px, ' +
(-renderer.canvas.width / Math.tan(config.hfov * Math.PI / 360) * (-renderer.canvas.width / Math.tan(config.hfov * Math.PI / 360) *
(Math.sin(hs.pitch * Math.PI / 180) * Math.cos(config.pitch * (Math.sin(hs.pitch * Math.PI / 180) * Math.cos(config.pitch *
Math.PI / 180) - Math.cos(hs.pitch * Math.PI / 180) * Math.PI / 180) - Math.cos(hs.pitch * Math.PI / 180) *
Math.cos((hs.yaw + config.yaw) * Math.PI / 180) *
Math.cos((-hs.yaw + config.yaw) * Math.PI / 180) *
Math.sin(config.pitch * Math.PI / 180)) / z / 2 + Math.sin(config.pitch * Math.PI / 180)) / z / 2 +
renderer.canvas.height / 2 - 13) + 'px) translateZ(1000000000px)'; renderer.canvas.height / 2 - 13) + 'px) translateZ(1000000000px)';
hs.div.style.webkitTransform = transform; hs.div.style.webkitTransform = transform;


Loading…
Cancel
Save