From 7676b9f2448b259b1d7f813b2059be8c0e47f434 Mon Sep 17 00:00:00 2001 From: jdotzki Date: Wed, 4 Mar 2015 15:27:13 +0100 Subject: [PATCH] fix(context pad): correct position of replace menu close #210 --- lib/features/context-pad/ContextPadProvider.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/features/context-pad/ContextPadProvider.js b/lib/features/context-pad/ContextPadProvider.js index bc3d7a03..23d5b096 100644 --- a/lib/features/context-pad/ContextPadProvider.js +++ b/lib/features/context-pad/ContextPadProvider.js @@ -76,16 +76,19 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) { function getPosition(element) { - var Y_OFFSET = 20; + var Y_OFFSET = 5; - var pad = contextPad.getPad(element); - var rect = pad.html.getBoundingClientRect(); + var diagramContainer = canvas.getContainer(), + 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 = { - x: rect.left, - y: (rect.top - rect.height * zoom / 2) + rect.height + Y_OFFSET + x: padRect.left, + y: top + padRect.height + Y_OFFSET }; return pos;