Skip to content

Commit

Permalink
Center inline controls popup.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmussen authored and mtias committed Feb 8, 2017
1 parent b528c0a commit 8647138
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ function onSelectText( event ) {
inlineControls.style.display = 'block';
var range = txt.getRangeAt(0);
var pos = range.getBoundingClientRect();
inlineControls.style.left = pos.left + 'px';
var selectCenter = pos.width / 2;
var controlsCenter = inlineControls.offsetWidth / 2;
inlineControls.style.left = ( pos.left + selectCenter - controlsCenter ) + 'px';
inlineControls.style.top = ( pos.top - 48 ) + 'px';
} else {
inlineControls.style.display = 'none';
Expand Down

0 comments on commit 8647138

Please sign in to comment.