REFACTOR: topic-entrance component (#7694)

This commit is contained in:
Joffrey JAFFEUX 2019-06-04 17:50:02 +02:00 committed by GitHub
parent 6de3824b46
commit f03a547a89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ export default Ember.Component.extend(CleansUp, {
_setCSS() {
const pos = this._position;
const $self = this.$();
const $self = $(this.element);
const width = $self.width();
const height = $self.height();
pos.left = parseInt(pos.left) - width / 2;
@ -74,8 +74,7 @@ export default Ember.Component.extend(CleansUp, {
_show(data) {
this._position = data.position;
this.set("topic", data.topic);
this.set("visible", true);
this.setProperties({ topic: data.topic, visible: true });
Ember.run.scheduleOnce("afterRender", this, this._setCSS);
@ -85,7 +84,7 @@ export default Ember.Component.extend(CleansUp, {
const $target = $(e.target);
if (
$target.prop("id") === "topic-entrance" ||
this.$().has($target).length !== 0
$(this.element).has($target).length !== 0
) {
return;
}
@ -94,8 +93,7 @@ export default Ember.Component.extend(CleansUp, {
},
cleanUp() {
this.set("topic", null);
this.set("visible", false);
this.setProperties({ topic: null, visible: false });
$("html").off("mousedown.topic-entrance");
},