Fix editor regressions and add Blender scene and animated material import

This commit is contained in:
emil28092005
2026-09-12 00:53:20 +03:00
parent 1a0bf725fa
commit 6f497d1977
34 changed files with 1241 additions and 213 deletions
+16
View File
@@ -0,0 +1,16 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {bindViewInput} from '../engine/view-input.ts';
test('shared player/editor controls request mouse lock and route touch look only while active',()=>{
const canvas=new EventTarget() as HTMLCanvasElement;let locks=0;const moves:number[][]=[];
canvas.requestPointerLock=async()=>{locks++;};canvas.setPointerCapture=()=>{};
const runtime={playing:true,paused:false,firstPerson:()=>true,lookBy:(x:number,y:number)=>moves.push([x,y])};
const cleanup=bindViewInput(canvas,runtime);
const send=(type:string,props:any)=>canvas.dispatchEvent(Object.assign(new Event(type),props));
send('pointerdown',{pointerType:'mouse',button:0});assert.equal(locks,1);
send('pointerdown',{pointerType:'touch',pointerId:3,clientX:10,clientY:10});
send('pointermove',{pointerId:3,clientX:20,clientY:5});assert.deepEqual(moves,[[.04,.02]]);
runtime.paused=true;send('pointerdown',{pointerType:'mouse',button:0});send('pointermove',{pointerId:3,clientX:30,clientY:0});
assert.equal(locks,1);assert.equal(moves.length,1);
runtime.paused=false;cleanup();send('pointerdown',{pointerType:'mouse',button:0});assert.equal(locks,1);
});