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