preventing rmb

This commit is contained in:
BroodjeAap 2022-09-18 09:08:13 +00:00
parent 7d0f1ce8c9
commit e6d8e0fa98
2 changed files with 16 additions and 7 deletions

View file

@ -75,6 +75,9 @@ function diagramOnMouseMove(ev) {
function diagramOnWheel(ev) {
//_diagram.onwheel(ev);
}
function diagramOnContext(ev) {
ev.preventDefault();
}
var Diagrams = /** @class */ (function () {
function Diagrams(canvasId) {
this.nodes = new Array();
@ -105,6 +108,7 @@ var Diagrams = /** @class */ (function () {
this.canvas.onmousedown = diagramOnMouseDown;
this.canvas.onmouseup = diagramOnMouseUp;
this.canvas.onwheel = diagramOnWheel;
this.canvas.oncontextmenu = diagramOnContext;
window.onresize = diargramOnResize;
}
Diagrams.prototype.onmousemove = function (ev) {
@ -181,6 +185,9 @@ var Diagrams = /** @class */ (function () {
this.panning = true;
};
Diagrams.prototype.onmouseup = function (ev) {
if (ev.button != 0) {
return;
}
this.panning = false;
this.nodeDragging = null;
if (this.makingConnectionNode !== null) {
@ -324,8 +331,6 @@ var Diagrams = /** @class */ (function () {
Diagrams.prototype.removeConnection = function (A, B) {
this.connections.splice(this.connections.indexOf([A, B]), 1);
};
Diagrams.prototype.drawDiagramNode = function (node) {
};
Diagrams.prototype.fillParent = function () {
this.canvas.width = this.canvas.clientWidth;
this.canvas.height = this.canvas.clientHeight;

View file

@ -99,6 +99,9 @@ function diagramOnMouseMove(ev: MouseEvent){
function diagramOnWheel(ev: WheelEvent){
//_diagram.onwheel(ev);
}
function diagramOnContext(ev: MouseEvent){
ev.preventDefault();
}
class Diagrams {
canvas: HTMLCanvasElement;
@ -140,6 +143,7 @@ class Diagrams {
this.canvas.onmousedown = diagramOnMouseDown;
this.canvas.onmouseup = diagramOnMouseUp;
this.canvas.onwheel = diagramOnWheel;
this.canvas.oncontextmenu = diagramOnContext;
window.onresize = diargramOnResize;
}
@ -218,6 +222,10 @@ class Diagrams {
}
onmouseup(ev: MouseEvent){
if (ev.button != 0){
return;
}
this.panning = false;
this.nodeDragging = null;
if (this.makingConnectionNode !== null){
@ -389,10 +397,6 @@ class Diagrams {
this.connections.splice(this.connections.indexOf([A, B]), 1);
}
drawDiagramNode(node: DiagramNode){
}
fillParent(){
this.canvas.width = this.canvas.clientWidth;
this.canvas.height = this.canvas.clientHeight;