ember-leaflet
ember-leaflet copied to clipboard
Popup width is not updated automatically when content changes
In my app, when the user clicks on a marker, a promise needs to be resolved before the popup content is rendered by Ember.
The problem is that the width seems to be computed only once (at the time the popup opens) and the popup ends-up being not wide enough for the content.
Any idea how to fix this ?
I circumvented the problem this way:
I had this:
{{#marker-layer}}
{{someObject.somePromiseObject.someProperty}}
{{/marker-layer}}
Changed it to:
{{#marker-layer}}
{{some-component someObject=someObject}}
{{/marker-layer}}
with templates/components/some-component.hbs:
{{someObject.somePromiseObject.someProperty}}
and components/some-component.js:
import Ember from 'ember';
export default Ember.Component.extend({
onDidUpdate: Ember.on('didUpdate', function() {
this.get('parentView._popup').update();
})
});
It works but it would be nice if it could be made built-in. Any idea on how to do this ?
Yes, the trick here is calling update
on the popup layer.
AFAIK, an automated way of doing this isn't possible. :/
Any ideas?