Przeglądaj źródła

Make fixed scaling a separate parameter (#1150).

Since it was introduced, the `scale` parameter could be set to `true` to
enable dynamic scaling. In 57ca64e741bde04efb039c7d58adcdbf6693c61c, it was
modified to instead set a fixed scaling if it were set to a number, but this
didn't allow for a fixed scaling to be set on top of the dynamic scaling.

This change restores the original behavior of the `scale` parameter and moves
fixed scaling to a new `scaleFactor` parameter. This change breaks the
previous fixed scaling behavior, but this was never in a released version.
pull/1238/head
Matthew Petroff 3 miesięcy temu
rodzic
commit
f361b36a13
2 zmienionych plików z 9 dodań i 8 usunięć
  1. +5
    -2
      doc/json-config-parameters.md
  2. +4
    -6
      src/js/pannellum.js

+ 5
- 2
doc/json-config-parameters.md Wyświetl plik

@@ -355,8 +355,11 @@ event object are: `mousedown`, `pointerdown`, `touchend`, `pointerup`, `pointerl
When `true`, the hot spot is scaled to match changes in the field of view,
relative to the initial field of view. Note that this does not account for
changes in local image scale that occur due to distortions within the viewport.
If set to a number, a fixed scaling is applied relative to the default hot spot
size. Defaults to `false`.
Defaults to `false`.

#### `scaleFactor` (number)

Applies a fixed scaling to the default hot spot size. Can be combined with `scale`.

### `hotSpotDebug` (boolean)



+ 4
- 6
src/js/pannellum.js Wyświetl plik

@@ -2083,12 +2083,10 @@ function renderHotSpot(hs) {
coord[1] += (canvasHeight - hs.div.offsetHeight) / 2;
var transform = 'translate(' + coord[0] + 'px, ' + coord[1] +
'px) translateZ(9999px) rotate(' + config.roll + 'deg)';
if (hs.scale) {
if (typeof hs.scale == 'number')
transform += ' scale(' + hs.scale + ')';
else
transform += ' scale(' + (origHfov/config.hfov) / z + ')';
}
if (hs.scale)
transform += ' scale(' + (hs.scaleFactor || 1) * (origHfov/config.hfov) / z + ')';
else if (hs.scaleFactor)
transform += ' scale(' + hs.scaleFactor + ')';
hs.div.style.webkitTransform = transform;
hs.div.style.MozTransform = transform;
hs.div.style.transform = transform;


Ładowanie…
Anuluj
Zapisz