Browse Source

:art: fix https://github.com/siyuan-note/siyuan/issues/11014

Vanessa 1 year ago
parent
commit
a773a56454
2 changed files with 6 additions and 7 deletions
  1. 2 1
      app/src/layout/Tab.ts
  2. 4 6
      app/src/layout/Wnd.ts

+ 2 - 1
app/src/layout/Tab.ts

@@ -7,7 +7,7 @@ import {Constants} from "../constants";
 import {escapeGreat, escapeHtml} from "../util/escape";
 import {unicode2Emoji} from "../emoji";
 import {fetchPost} from "../util/fetch";
-import {showTooltip} from "../dialog/tooltip";
+import {hideTooltip, showTooltip} from "../dialog/tooltip";
 import {isTouchDevice} from "../util/functions";
 /// #if !BROWSER
 import {openNewWindow} from "../window/openNewWindow";
@@ -77,6 +77,7 @@ export class Tab {
                     return;
                 }
                 window.getSelection().removeAllRanges();
+                hideTooltip();
                 const tabElement = hasClosestByTag(event.target, "LI");
                 if (tabElement) {
                     event.dataTransfer.setData("text/html", tabElement.outerHTML);

+ 4 - 6
app/src/layout/Wnd.ts

@@ -315,15 +315,13 @@ export class Wnd {
             const width = rect.width;
             const x = event.clientX - rect.left;
             const y = event.clientY - rect.top;
-            if ((x <= width / 3 && (y <= height / 8 || y >= height * 7 / 8)) ||
-                (x <= width / 8 && (y > height / 8 || y < height * 7 / 8))) {
+            if (x <= width / 8 || (x <= width / 3 && x > width / 8 && y >= height / 8 && y <= height * 7 / 8)) {
                 dragElement.setAttribute("style", "height:100%;width:50%;right:50%;bottom:0;left:0;top:0");
-            } else if ((x > width * 2 / 3 && (y <= height / 8 || y >= height * 7 / 8)) ||
-                (x >= width * 7 / 8 && (y > height / 8 || y < height * 7 / 8))) {
+            } else if (x >= width * 7 / 8 || (x >= width * 2 / 3 && x < width * 7 / 8 && y >= height / 8 && y <= height * 7 / 8)) {
                 dragElement.setAttribute("style", "height:100%;width:50%;right:0;bottom:0;left:50%;top:0");
-            } else if (x > width / 3 && x < width * 2 / 3 && y <= height / 8) {
+            } else if (y <= height / 8) {
                 dragElement.setAttribute("style", "height:50%;width:100%;right:0;bottom:50%;left:0;top:0");
-            } else if (x > width / 3 && x < width * 2 / 3 && y >= height * 7 / 8) {
+            } else if (y >= height * 7 / 8) {
                 dragElement.setAttribute("style", "height:50%;width:100%;right:0;bottom:0;left:0;top:50%");
             } else {
                 dragElement.setAttribute("style", "height:100%;width:100%;right:0;bottom:0;top:0;left:0");