PolymerElements / iron-fit-behavior

Fits an element into another element
17 stars 34 forks source link

Wrong position on open due to incorrect measure position #20

Closed padster closed 8 years ago

padster commented 9 years ago

I ran into an issue where the popup was measured incorrectly before being opened.

Tracking it down, the error is in these lines: https://github.com/PolymerElements/iron-fit-behavior/blob/master/iron-fit-behavior.html#L204

Setting this.style.top / this.style.left to '0px' inside constrain() has no effect, as the position:fixed isn't added until inside center()

Is it ok just to move the position:fixed set to within constrain instead?

cyscott commented 9 years ago

I was having the same problem. Your suggested solution worked for me.

cdata commented 8 years ago

Can you provide more specific conditions under which this would occur, and then re-open the issue? Thanks!

padster commented 8 years ago

I can't give the exact example I triggered it with, but to summarize, it was along the lines of:

<body>
  <root-view>
    <paper-drawer-panel>... </>
    <paper-dialog modal> ...content... </>
  </>
</>

Stuff inside the panel was used to fill content in the dialog, then open it centered in the middle of the page. It would pop up incorrectly, due to measure issue mentioned in line 3 of the original post.