mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Share a scene's camera-input holds beyond the dispatcher
The take-over of the camera controller's enableInputs moves, unchanged, to src/render/cesium/cameraInput.js. acquireCameraInput(scene) gives every user one set of counted holds per scene, so the renderer's input and camera ports can hold camera input alongside the dispatcher; the controller gets its own property back when the last user releases. The dispatcher acquires its share once its handler is bound. The input guard names the one module allowed to write the flag, and the new render files join the format scope.
This commit is contained in:
1 parent
35a73b6fda
commit
ad98c80118
7 files changed
+237
-77
No files matched your search
@@ -186,6 +186,7 @@ test('consumer build includes only infrastructure code and resolves assets under
|
||||
const entry = output.find((item) => item.type === 'chunk' && item.isEntry);
|
||||
const sources = Object.keys(entry.modules).filter((id) => id.endsWith('.js'));
|
||||
assert.deepEqual(sources.map((id) => id.split('/').at(-1)).sort(), [
|
||||
'cameraInput.js',
|
||||
'dispatcher.js',
|
||||
'heights.js',
|
||||
'infrastructure.js',
|
||||
|
||||
@@ -115,18 +115,23 @@ test('pointer input, camera holds and the stock clicks go through the one dispat
|
||||
// edit each layer. A layer that binds its own handler, writes the camera
|
||||
// flag or takes the stock clicks itself steps around that contract.
|
||||
const DISPATCHER = 'src/input/dispatcher.js';
|
||||
// Each rule names the one other module it belongs in, if any.
|
||||
const rules = [
|
||||
[
|
||||
/new\s+[\w.]*ScreenSpaceEventHandler\(/,
|
||||
'binds its own ScreenSpaceEventHandler',
|
||||
[],
|
||||
],
|
||||
[
|
||||
/\.enableInputs\s*=(?!=)/,
|
||||
'writes enableInputs instead of suspendCamera()',
|
||||
// The scene's camera-input holds, which own the flag.
|
||||
['src/render/cesium/cameraInput.js'],
|
||||
],
|
||||
[
|
||||
/screenSpaceEventHandler\??\.removeInputAction\(/,
|
||||
'removes stock clicks instead of suppressStockClicks()',
|
||||
[],
|
||||
],
|
||||
];
|
||||
const walk = (dir) =>
|
||||
@@ -141,8 +146,9 @@ test('pointer input, camera holds and the stock clicks go through the one dispat
|
||||
for (const file of walk('src')) {
|
||||
if (file === DISPATCHER) continue;
|
||||
const source = read(file);
|
||||
for (const [pattern, what] of rules)
|
||||
if (pattern.test(source)) offenders.push(`${file} ${what}`);
|
||||
for (const [pattern, what, allowed] of rules)
|
||||
if (!allowed.includes(file) && pattern.test(source))
|
||||
offenders.push(`${file} ${what}`);
|
||||
}
|
||||
assert.deepEqual(offenders, []);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user