From 5f36f0d88eb746afd76d348b6608582af03dfe45 Mon Sep 17 00:00:00 2001 From: Xen Date: Sun, 17 May 2020 14:13:05 +0800 Subject: [PATCH 1/2] add necessary comment --- src/base.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/base.js b/src/base.js index efa1219..143aa70 100755 --- a/src/base.js +++ b/src/base.js @@ -266,17 +266,22 @@ document.onkeydown = function (e) { } }; -// prevent text select for double click action -// Note: all click event is eaten by system for drag element on Windows, -// so, nav-area mousedown and dbclick event can't be captured by below code +// For drag region which nav-area is, the behavior is different between Mac and Windows: +// On Windows a drag region is take a system title bar, and all event is captured by +// system, app can't get any click or mouse event. At the same time, double click event +// will resize app window by system, no need for app to implement such function. +// On Mac, a drag region has no much different except supporting drag action. App can +// capture most event and window resize(maximum and restore) should be implemented +// by app. +// In short, below two listener, onmousedown and ondbclick is only needed on Mac, Windows +// system has implement similar function. There's a drawback on Windows that maximum +// button info is not sync with system maximum and restore. document.getElementById("nav-area").onmousedown = () => { - console.log("nav-area mounse down"); + // prevent text select for double click action return false; }; document.getElementById("nav-area").ondblclick = () => { - console.log("dbclick"); - if ( window.innerWidth === screen.width || window.innerHeight === screen.height From 853d30a2ce080438b878e641af7b322987e11394 Mon Sep 17 00:00:00 2001 From: Xen Date: Sun, 17 May 2020 14:18:58 +0800 Subject: [PATCH 2/2] linux has similar behavior with Windows --- src/base.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base.js b/src/base.js index 143aa70..9466314 100755 --- a/src/base.js +++ b/src/base.js @@ -266,8 +266,8 @@ document.onkeydown = function (e) { } }; -// For drag region which nav-area is, the behavior is different between Mac and Windows: -// On Windows a drag region is take a system title bar, and all event is captured by +// For drag region which nav-area is, the behavior is different between Mac and Windows/Debian: +// On Windows/Debian a drag region is take a system title bar, and all event is captured by // system, app can't get any click or mouse event. At the same time, double click event // will resize app window by system, no need for app to implement such function. // On Mac, a drag region has no much different except supporting drag action. App can