nullify contextmenu
This commit is contained in:
parent
b6b069450d
commit
0e4ae45d01
2 changed files with 12 additions and 9 deletions
|
@ -83,6 +83,10 @@ export class Agent {
|
|||
{ once: true }
|
||||
);
|
||||
});
|
||||
this.cnv.addEventListener('contextmenu', e => {
|
||||
e.preventDefault();
|
||||
// TODO: Custom context menu support
|
||||
});
|
||||
document.addEventListener('mousemove', (e) => {
|
||||
if (!this.dragging) return;
|
||||
this.x += e.movementX;
|
||||
|
@ -180,9 +184,11 @@ export class Agent {
|
|||
}
|
||||
|
||||
hide(remove: boolean = false) {
|
||||
this.playAnimationByName('Hide', () => {
|
||||
if (remove) this.remove();
|
||||
else this.cnv.style.display = 'none';
|
||||
});
|
||||
this.playAnimationByName("Hide", () => {
|
||||
if(remove)
|
||||
this.remove();
|
||||
else
|
||||
this.cnv.style.display = 'none';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import * as msagent from "@msagent-chat/msagent.js";
|
||||
let w = window as any;
|
||||
w.agents = [];
|
||||
let input = document.getElementById("testbed-input") as HTMLInputElement;
|
||||
|
||||
input.addEventListener("change", async () => {
|
||||
|
@ -11,12 +12,8 @@ input.addEventListener("change", async () => {
|
|||
console.log("Creating agent");
|
||||
let agent = msagent.agentCreateCharacter(new Uint8Array(buffer));
|
||||
|
||||
// destroy the previous agent
|
||||
if(w.agent != null) {
|
||||
w.agent.hide(true);
|
||||
}
|
||||
w.agents.push(agent);
|
||||
|
||||
w.agent = agent;
|
||||
agent.addToDom(document.body);
|
||||
|
||||
agent.show();
|
||||
|
|
Loading…
Reference in a new issue