FIX: On IOS9 the topic entrance was resizing the topic list

This commit is contained in:
Robin Ward 2015-10-13 16:59:32 -04:00
parent 7802757306
commit bf53938ab7

View file

@ -6,32 +6,31 @@ export default Ember.View.extend(CleansUp, {
visible: Em.computed.notEmpty('controller.model'), visible: Em.computed.notEmpty('controller.model'),
_positionChanged: function() { _positionChanged: function() {
var pos = this.get('controller.position'); const pos = this.get('controller.position');
if (!pos) { return; } if (!pos) { return; }
var $self = this.$(); const $self = this.$();
// Move after we render so the height is correct // Move after we render so the height is correct
Em.run.schedule('afterRender', function() { Em.run.schedule('afterRender', function() {
var width = $self.width(), const width = $self.width(),
height = $self.height(); height = $self.height();
pos.left = (parseInt(pos.left) - (width / 2)); pos.left = (parseInt(pos.left) - (width / 2));
pos.top = (parseInt(pos.top) - (height / 2)); pos.top = (parseInt(pos.top) - (height / 2));
var windowWidth = $(window).width(); const windowWidth = $(window).width();
if (pos.left + width > windowWidth) { if (pos.left + width > windowWidth) {
pos.left = (windowWidth - width) - 5; pos.left = (windowWidth - width) - 15;
} }
$self.css(pos); $self.css(pos);
}); });
var self = this; $('html').off('mousedown.topic-entrance').on('mousedown.topic-entrance', e => {
$('html').off('mousedown.topic-entrance').on('mousedown.topic-entrance', function(e) { const $target = $(e.target);
var $target = $(e.target);
if (($target.prop('id') === 'topic-entrance') || ($self.has($target).length !== 0)) { if (($target.prop('id') === 'topic-entrance') || ($self.has($target).length !== 0)) {
return; return;
} }
self.cleanUp(); this.cleanUp();
}); });
}.observes('controller.position'), }.observes('controller.position'),
@ -39,12 +38,12 @@ export default Ember.View.extend(CleansUp, {
$('html').off('mousedown.topic-entrance'); $('html').off('mousedown.topic-entrance');
}.on('willDestroyElement'), }.on('willDestroyElement'),
cleanUp: function() { cleanUp() {
this.set('controller.model', null); this.set('controller.model', null);
$('html').off('mousedown.topic-entrance'); $('html').off('mousedown.topic-entrance');
}, },
keyDown: function(e) { keyDown(e) {
if (e.which === 27) { if (e.which === 27) {
this.cleanUp(); this.cleanUp();
} }