fix(context pad): correct position of replace menu

close #210
This commit is contained in:
jdotzki 2015-03-04 15:27:13 +01:00
parent 88eb0cb442
commit 7676b9f244
1 changed files with 9 additions and 6 deletions

View File

@ -76,16 +76,19 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
function getPosition(element) { function getPosition(element) {
var Y_OFFSET = 20; var Y_OFFSET = 5;
var pad = contextPad.getPad(element); var diagramContainer = canvas.getContainer(),
var rect = pad.html.getBoundingClientRect(); pad = contextPad.getPad(element).html;
var zoom = 1 / canvas.zoom(); var diagramRect = diagramContainer.getBoundingClientRect(),
padRect = pad.getBoundingClientRect();
var top = padRect.top - diagramRect.top;
var pos = { var pos = {
x: rect.left, x: padRect.left,
y: (rect.top - rect.height * zoom / 2) + rect.height + Y_OFFSET y: top + padRect.height + Y_OFFSET
}; };
return pos; return pos;