This commit is contained in:
Mirco Wittrien 2021-01-20 16:57:41 +01:00
parent a3a9881220
commit 05d75fe781
2 changed files with 19 additions and 17 deletions

View File

@ -722,6 +722,7 @@
"customStatusItem": "customStatusItem-f5Trsa", "customStatusItem": "customStatusItem-f5Trsa",
"deleteButton": "deleteButton-k8a4Sa", "deleteButton": "deleteButton-k8a4Sa",
"deleteIcon": "deleteIcon-22SgHa", "deleteIcon": "deleteIcon-22SgHa",
"dragPreview": "dragPreview-3F0ssT",
"sortableCard": "sortableCard-oF6sTT", "sortableCard": "sortableCard-oF6sTT",
"sortDivider": "sortDivider-d8SzzU" "sortDivider": "sortDivider-d8SzzU"
}, },
@ -1181,6 +1182,7 @@
"_customstatuspresetscustomstatusitem": ["CustomStatusPresets", "customStatusItem"], "_customstatuspresetscustomstatusitem": ["CustomStatusPresets", "customStatusItem"],
"_customstatuspresetsdeletebutton": ["CustomStatusPresets", "deleteButton"], "_customstatuspresetsdeletebutton": ["CustomStatusPresets", "deleteButton"],
"_customstatuspresetsdeleteicon": ["CustomStatusPresets", "deleteIcon"], "_customstatuspresetsdeleteicon": ["CustomStatusPresets", "deleteIcon"],
"_customstatuspresetsdragpreview": ["CustomStatusPresets", "dragPreview"],
"_customstatuspresetssortablecard": ["CustomStatusPresets", "sortableCard"], "_customstatuspresetssortablecard": ["CustomStatusPresets", "sortableCard"],
"_customstatuspresetssortdivider": ["CustomStatusPresets", "sortDivider"], "_customstatuspresetssortdivider": ["CustomStatusPresets", "sortDivider"],
"_displaylargemessagesinjectbutton": ["DisplayLargeMessages", "injectButton"], "_displaylargemessagesinjectbutton": ["DisplayLargeMessages", "injectButton"],

View File

@ -141,12 +141,12 @@ module.exports = (_ => {
if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) { if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) {
BDFDB.ListenerUtils.stopEvent(event); BDFDB.ListenerUtils.stopEvent(event);
this.draggedGuild = guildId; this.draggedGuild = guildId;
let dragpreview = _this.createDragPreview(BDFDB.ReactUtils.findDOMNode(instance).cloneNode(true), event2); let dragPreview = _this.createDragPreview(BDFDB.ReactUtils.findDOMNode(instance).cloneNode(true), event2);
BDFDB.ReactUtils.forceUpdate(this); BDFDB.ReactUtils.forceUpdate(this);
document.removeEventListener("mousemove", mouseMove); document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp); document.removeEventListener("mouseup", mouseUp);
let dragging = event3 => { let dragging = event3 => {
_this.updateDragPreview(dragpreview, event3); _this.updateDragPreview(dragPreview, event3);
let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._serverfoldersguildplaceholder, event3.target); let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._serverfoldersguildplaceholder, event3.target);
let hoveredGuild = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCNS._serverfoldersfoldercontent + BDFDB.dotCN.guildouter, placeholder ? placeholder.previousSibling : event3.target), "guild", {up: true}) || {}).id; let hoveredGuild = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCNS._serverfoldersfoldercontent + BDFDB.dotCN.guildouter, placeholder ? placeholder.previousSibling : event3.target), "guild", {up: true}) || {}).id;
if (hoveredGuild) { if (hoveredGuild) {
@ -160,7 +160,7 @@ module.exports = (_ => {
}; };
let releasing = event3 => { let releasing = event3 => {
BDFDB.ListenerUtils.stopEvent(event3); BDFDB.ListenerUtils.stopEvent(event3);
BDFDB.DOMUtils.remove(dragpreview); BDFDB.DOMUtils.remove(dragPreview);
if (this.hoveredGuild) { if (this.hoveredGuild) {
let guildIds = [].concat(folder.guildIds); let guildIds = [].concat(folder.guildIds);
BDFDB.ArrayUtils.remove(guildIds, this.draggedGuild, true); BDFDB.ArrayUtils.remove(guildIds, this.draggedGuild, true);
@ -1147,22 +1147,22 @@ module.exports = (_ => {
createDragPreview (div, event) { createDragPreview (div, event) {
if (!Node.prototype.isPrototypeOf(div)) return; if (!Node.prototype.isPrototypeOf(div)) return;
let dragpreview = div.cloneNode(true); let dragPreview = div.cloneNode(true);
BDFDB.DOMUtils.addClass(dragpreview, BDFDB.disCN._serverfoldersdragpreview); BDFDB.DOMUtils.addClass(dragPreview, BDFDB.disCN._serverfoldersdragpreview);
BDFDB.DOMUtils.remove(dragpreview.querySelector(BDFDB.dotCNC.guildlowerbadge + BDFDB.dotCNC.guildupperbadge + BDFDB.dotCN.guildpillwrapper)); BDFDB.DOMUtils.remove(dragPreview.querySelector(BDFDB.dotCNC.guildlowerbadge + BDFDB.dotCNC.guildupperbadge + BDFDB.dotCN.guildpillwrapper));
BDFDB.DOMUtils.hide(dragpreview); BDFDB.DOMUtils.hide(dragPreview);
dragpreview.style.setProperty("pointer-events", "none", "important"); dragPreview.style.setProperty("pointer-events", "none", "important");
dragpreview.style.setProperty("left", event.clientX - 25 + "px", "important"); dragPreview.style.setProperty("left", event.clientX - 25 + "px", "important");
dragpreview.style.setProperty("top", event.clientY - 25 + "px", "important"); dragPreview.style.setProperty("top", event.clientY - 25 + "px", "important");
document.querySelector(BDFDB.dotCN.appmount).appendChild(dragpreview); document.querySelector(BDFDB.dotCN.appmount).appendChild(dragPreview);
return dragpreview; return dragPreview;
} }
updateDragPreview (dragpreview, event) { updateDragPreview (dragPreview, event) {
if (!Node.prototype.isPrototypeOf(dragpreview)) return; if (!Node.prototype.isPrototypeOf(dragPreview)) return;
BDFDB.DOMUtils.show(dragpreview); BDFDB.DOMUtils.show(dragPreview);
dragpreview.style.setProperty("left", event.clientX - 25 + "px", "important"); dragPreview.style.setProperty("left", event.clientX - 25 + "px", "important");
dragpreview.style.setProperty("top", event.clientY - 25 + "px", "important"); dragPreview.style.setProperty("top", event.clientY - 25 + "px", "important");
} }
setLabelsByLanguage () { setLabelsByLanguage () {