SharpMeow commited on
Commit
212a55c
·
verified ·
1 Parent(s): 943fb39

Starting view one wheel step farther out (OPEN_STEP = 1/0.95^zoomSpeed on the fitted distance)

Browse files
Files changed (2) hide show
  1. app.js +4 -2
  2. index.html +1 -1
app.js CHANGED
@@ -987,6 +987,7 @@ let mode = 'roll'; // roll: follow the roll; overview: the whole strip; free:
987
  let fly = null;
988
  // view directions onto the roll; the distance and a sideways shift come from fitView(): the roll's own height and
989
  // width are fitted into the part of the screen the control panel, header and scrubber leave free
 
990
  const ROLL_DIR = new THREE.Vector3(-105, 52, 235).normalize();
991
  const ROLL_DIR_PORTRAIT = new THREE.Vector3(-70, 70, 330).normalize();
992
  const ROLL_OFF = new THREE.Vector3(), ROLL_SHIFT = new THREE.Vector3();
@@ -1042,13 +1043,14 @@ function fitView() {
1042
  // seen from a little above: the projected height is about the height plus a share of the diameter
1043
  const elev = Math.asin(Math.min(1, dir.y));
1044
  const ph = rh * Math.cos(elev) + rw * Math.sin(elev);
1045
- const D = Math.max(ph / 2 / (tv * fh * 0.78), rw / 2 / (tv * camera.aspect * fw * (portrait ? 0.7 : 0.35)), 60);
 
1046
  ROLL_OFF.copy(dir).multiplyScalar(D);
1047
  // landscape: the roll sits right of the free area's centre, so the emerging strip (to its left) has room
1048
  const px = fr.x0 + (fr.x1 - fr.x0) * (portrait ? 0.54 : 0.62), py = (fr.y0 + fr.y1) / 2;
1049
  ndcShift(dir, D, px / W * 2 - 1, 1 - py / H * 2, ROLL_SHIFT);
1050
  // the intro's view down the axis, centred in the same free area
1051
- const td = new THREE.Vector3(0, 120, 7), tD = Math.max(120, td.length() * 0.5 / Math.min(fw, fh));
1052
  td.setLength(tD);
1053
  const tx = (fr.x0 + fr.x1) / 2;
1054
  TOP_TARGET.set(0, -2, 0).add(ndcShift(td.clone().normalize(), tD, tx / W * 2 - 1, 1 - py / H * 2, new THREE.Vector3()));
 
987
  let fly = null;
988
  // view directions onto the roll; the distance and a sideways shift come from fitView(): the roll's own height and
989
  // width are fitted into the part of the screen the control panel, header and scrubber leave free
990
+ const OPEN_STEP = 1 / Math.pow(0.95, controls.zoomSpeed); // about 1.047 at zoomSpeed 0.9
991
  const ROLL_DIR = new THREE.Vector3(-105, 52, 235).normalize();
992
  const ROLL_DIR_PORTRAIT = new THREE.Vector3(-70, 70, 330).normalize();
993
  const ROLL_OFF = new THREE.Vector3(), ROLL_SHIFT = new THREE.Vector3();
 
1043
  // seen from a little above: the projected height is about the height plus a share of the diameter
1044
  const elev = Math.asin(Math.min(1, dir.y));
1045
  const ph = rh * Math.cos(elev) + rw * Math.sin(elev);
1046
+ // OPEN_STEP: open one OrbitControls wheel step (at devicePixelRatio 1) farther out than the plain fit
1047
+ const D = OPEN_STEP * Math.max(ph / 2 / (tv * fh * 0.78), rw / 2 / (tv * camera.aspect * fw * (portrait ? 0.7 : 0.35)), 60);
1048
  ROLL_OFF.copy(dir).multiplyScalar(D);
1049
  // landscape: the roll sits right of the free area's centre, so the emerging strip (to its left) has room
1050
  const px = fr.x0 + (fr.x1 - fr.x0) * (portrait ? 0.54 : 0.62), py = (fr.y0 + fr.y1) / 2;
1051
  ndcShift(dir, D, px / W * 2 - 1, 1 - py / H * 2, ROLL_SHIFT);
1052
  // the intro's view down the axis, centred in the same free area
1053
+ const td = new THREE.Vector3(0, 120, 7), tD = OPEN_STEP * Math.max(120, td.length() * 0.5 / Math.min(fw, fh));
1054
  td.setLength(tD);
1055
  const tx = (fr.x0 + fr.x1) / 2;
1056
  TOP_TARGET.set(0, -2, 0).add(ndcShift(td.clone().normalize(), tD, tx / W * 2 - 1, 1 - py / H * 2, new THREE.Vector3()));
index.html CHANGED
@@ -251,7 +251,7 @@ if (!/(^|[#&])s=/.test(location.hash)) ['scrolls/index.json', 'scrolls/PHerc0139
251
  </div>
252
  </section>
253
 
254
- <script type="module" src="app.js?v=20261016vol3nan"></script>
255
  <script type="module" src="polish.js?v=20261016vol3"></script>
256
  <script type="module" src="lib/bench.js?v=20261016vol3"></script>
257
  <script type="module" src="ui.js?v=20261016vol3"></script>
 
251
  </div>
252
  </section>
253
 
254
+ <script type="module" src="app.js?v=20261016vol3zoom"></script>
255
  <script type="module" src="polish.js?v=20261016vol3"></script>
256
  <script type="module" src="lib/bench.js?v=20261016vol3"></script>
257
  <script type="module" src="ui.js?v=20261016vol3"></script>