mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(render): an icon's offset may scale with it, and an axis-turned icon turns by its rotation too
The contract gains offsetScalesByDistance: the pixel offset grows and shrinks with scaleByDistance, as Cesium's pixelOffsetScaleByDistance does with the same curve. rotationMode 'axis' now also turns by rotation, as a Cesium billboard with an aligned axis and a rotation does. Cesium draws both on its billboards; its GPU icons take the rotation and refuse a scaled offset; the stub picks both. New conformance check draw.icons.offsetTurn.
This commit is contained in:
1 parent
c99c577b3e
commit
7ba15deb5e
6 files changed
+113
-12
No files matched your search
@@ -1146,15 +1146,20 @@ export function createStubRenderer(options = {}) {
|
||||
let dy = y - cy;
|
||||
if (set.kind === 'icons') {
|
||||
const lift = { bottom: 1, top: -1 }[item.anchor] ?? 0;
|
||||
cx += item.pixelOffset?.x ?? 0;
|
||||
// Its offset shrinks with it when it says so.
|
||||
const offsetScale = item.offsetScalesByDistance ? scale : 1;
|
||||
cx += (item.pixelOffset?.x ?? 0) * offsetScale;
|
||||
cy +=
|
||||
(item.pixelOffset?.y ?? 0) -
|
||||
(item.pixelOffset?.y ?? 0) * offsetScale -
|
||||
(lift * (item.size?.[1] ?? 0) * scale) / 2;
|
||||
dx = x - cx;
|
||||
dy = y - cy;
|
||||
// Turned counter-clockwise on screen (its up along the axis
|
||||
// as projected there): the pick turned back.
|
||||
let turn = item.rotationMode === 'screen' ? (item.rotation ?? 0) : 0;
|
||||
// as projected there, then by its rotation): the pick turned back.
|
||||
let turn =
|
||||
item.rotationMode === 'screen' || item.rotationMode === 'axis'
|
||||
? (item.rotation ?? 0)
|
||||
: 0;
|
||||
const axis = item.rotationMode === 'axis' ? item.alignedAxis : null;
|
||||
if (
|
||||
axis &&
|
||||
@@ -1164,7 +1169,7 @@ export function createStubRenderer(options = {}) {
|
||||
add(p, normalize(vec(axis.x ?? 0, axis.y ?? 0, axis.z ?? 0))),
|
||||
);
|
||||
if (tip && (tip.x !== s.x || tip.y !== s.y))
|
||||
turn = Math.atan2(-(tip.x - s.x), -(tip.y - s.y));
|
||||
turn += Math.atan2(-(tip.x - s.x), -(tip.y - s.y));
|
||||
}
|
||||
if (turn !== 0) {
|
||||
const c = Math.cos(turn);
|
||||
|
||||
Reference in new issue
Block a user