javascript - Firefox Add-on SDK: create Panel right below selected text, even with zoom and sidebars -


i'm using firefox add-on sdk create panel when user selects text in page. panel should appear below , right of selected text, use following (in content script) position:

var sel = window.getselection(); var range = sel.getrangeat(0); var rect = range.getboundingclientrect(); var position = {left: rect.right, top: rect.bottom} ... 

this position sent in event , used position panel. works well, there 2 issues:

  • page zoom level
  • browser sidebars

the position returned getboundingclientrect (and getclientrects) not account these, the panel has offset right position if sidebar open (left sidebars make panel move left relative text) or zoom applied.

is there way always calculate real position panel should shown? (maybe using sdk/window/utils module?)


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -