FIX: emoji-picker positioning glitches on few edge cases

This commit is contained in:
Joffrey JAFFEUX 2017-07-20 17:03:45 +02:00
parent a5a3651cf3
commit a9ab3f9ef0
1 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ const PER_ROW = 11;
const customEmojis = _.map(_.keys(extendedEmojiList()), code => { const customEmojis = _.map(_.keys(extendedEmojiList()), code => {
return { code, src: emojiUrlFor(code) }; return { code, src: emojiUrlFor(code) };
}); });
let $picker, $modal, $filter, $results, $list; let $picker, $filter, $results, $list;
export default Ember.Component.extend({ export default Ember.Component.extend({
willDestroyElement() { willDestroyElement() {
@ -371,8 +371,8 @@ export default Ember.Component.extend({
const desktopModalePositioning = options => { const desktopModalePositioning = options => {
const attributes = { const attributes = {
width: windowWidth < 450 ? windowWidth - 12 : 400, width: Math.min(windowWidth, 400) - 12,
marginLeft: -($picker.width() / 2) + 12, marginLeft: -(Math.min(windowWidth, 400)/2) + 6,
marginTop: -130, marginTop: -130,
left: "50%", left: "50%",
bottom: "", bottom: "",
@ -403,7 +403,7 @@ export default Ember.Component.extend({
const desktopPositioning = options => { const desktopPositioning = options => {
const attributes = { const attributes = {
width: windowWidth < 450 ? windowWidth - 12 : 400, width: windowWidth < 485 ? windowWidth - 12 : 400,
marginLeft: "", marginLeft: "",
marginTop: "", marginTop: "",
right: "", right: "",
@ -424,7 +424,7 @@ export default Ember.Component.extend({
} else { } else {
if(this._isReplyControlExpanded()) { if(this._isReplyControlExpanded()) {
let $editorWrapper = Ember.$(".d-editor-preview-wrapper"); let $editorWrapper = Ember.$(".d-editor-preview-wrapper");
if(($editorWrapper.is(":visible") && $editorWrapper.width() < 400) || windowWidth < 450) { if(($editorWrapper.is(":visible") && $editorWrapper.width() < 400) || windowWidth < 485) {
desktopModalePositioning(); desktopModalePositioning();
} else { } else {
if($editorWrapper.is(":visible")) { if($editorWrapper.is(":visible")) {
@ -439,7 +439,7 @@ export default Ember.Component.extend({
} }
} }
} else { } else {
if(windowWidth < 450) { if(windowWidth < 485) {
desktopModalePositioning(); desktopModalePositioning();
} else { } else {
let previewInputOffset = Ember.$(".d-editor-input").offset(); let previewInputOffset = Ember.$(".d-editor-input").offset();