Skip to content

Commit

Permalink
right click providing bug fixed for FF
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryfar committed Mar 5, 2013
1 parent 540880d commit 4a16294
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
13 changes: 12 additions & 1 deletion index.html
Expand Up @@ -30,6 +30,7 @@
<div id="diagramBreadCrumbs" class="diagramBreadCrumbs" onmousedown="return false" onselectstart="return false"></div>
<div id="diagramHolder" class="diagramHolder"></div>
<div class="diagram-info" id="diagramInfo"></div>
<div class="debug-info" id="debugInfo"></div>
</div>
</div>
<script language='javascript'>
Expand Down Expand Up @@ -77,17 +78,23 @@
// Load processDefinition
ProcessDiagramGenerator.drawDiagram(processDefiniton.processDefinitionId);
}

var debugInfo = $("#debugInfo"); if (debugInfo) debugInfo.html("ON ELEMENT CLICK");
},
rightClick: function(canvas, element, contextObject){
// ON ELEMENT RIGHT CLICK
var mouseEvent = this;
console.log("[RIGHTCLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);

var debugInfo = $("#debugInfo"); if (debugInfo) debugInfo.html("ON ELEMENT RIGHT CLICK");
},
canvasClick: function(canvas, element){
// ON CANVAS RIGHT CLICK
// ON CANVAS CLICK
var debugInfo = $("#debugInfo"); if (debugInfo) debugInfo.html("ON CANVAS CLICK");
},
canvasRightClick: function(canvas, element){
// ON CANVAS RIGHT CLICK
var debugInfo = $("#debugInfo"); if (debugInfo) debugInfo.html("ON CANVAS RIGHT CLICK");
},
over: function(canvas, element, contextObject){
// ON ELEMENT OVER
Expand All @@ -96,13 +103,17 @@

// TODO: show tooltip-window with contextObject info
ProcessDiagramGenerator.showActivityInfo(contextObject);

var debugInfo = $("#debugInfo"); if (debugInfo) debugInfo.html("ON ELEMENT OVER");
},
out: function(canvas, element, contextObject){
// ON ELEMENT OUT
var mouseEvent = this;
//console.log("[OUT] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject);

ProcessDiagramGenerator.hideInfo();

var debugInfo = $("#debugInfo"); if (debugInfo) debugInfo.html("ON ELEMENT OUT");
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion js/ProcessDiagramCanvas.js
Expand Up @@ -178,7 +178,7 @@ ProcessDiagramCanvas.prototype = {
ProcessDiagramGenerator.options.on.canvasRightClick.apply(event, args);
}
};
this.canvas.click(function(){
this.canvas.click(function(event){
var element = this;
if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.canvasClick) {
var args = [instance, element];
Expand Down
12 changes: 8 additions & 4 deletions js/ProcessDiagramGenerator.js
Expand Up @@ -455,12 +455,16 @@ var ProcessDiagramGenerator = {
// Protect right click on SVG elements (and on canvas too)
document.body.oncontextmenu = function(event) {
// Now canvas is RECT with canvasWidth and canvasHeight
//var isCanvas = (window.event.srcElement.parentElement.className == "diagram");
//var isCanvas = (event.srcElement.parentElement.className == "diagram");

var isSVGElement = Object.isSVGElement(window.event.srcElement);
if (!event) event = window.event;
var element = event.target;
if (!element) element = event.srcElement;

if (isSVGElement && window.event.srcElement.rightClick)
window.event.srcElement.rightClick(event);
var isSVGElement = Object.isSVGElement(element);

if (isSVGElement && element.rightClick)
element.rightClick(event);

if (/*isCanvas ||*/ isSVGElement)
return false;
Expand Down
2 changes: 1 addition & 1 deletion style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4a16294

Please sign in to comment.