minor fix on float list

This commit is contained in:
lxsang 2020-07-14 23:20:15 +02:00
parent 4cb01bff05
commit b86565212a
2 changed files with 6 additions and 3 deletions

View File

@ -752,11 +752,13 @@ namespace OS {
* @export
* @param {string} k the hotkey e.g. `ALT-C`
* @param {(e: JQuery.MouseDownEvent) => void} f handle function
* @param {boolean} force force to rebind the hotkey
* @returns {void}
*/
export function bindKey(
k: string,
f: (e: JQuery.MouseDownEvent) => void
f: (e: JQuery.MouseDownEvent) => void,
force: boolean = true
): void {
const arr = k.split("-");
if (arr.length !== 2) {
@ -767,6 +769,7 @@ namespace OS {
if (!shortcut[fnk]) {
return;
}
if (shortcut[fnk][c] && !force) return;
shortcut[fnk][c] = f;
}

View File

@ -217,13 +217,13 @@ namespace OS {
const h = $(e).height();
if (this.dir === "vertical") {
ctop += h + 20;
if (ctop > gh) {
if (ctop + h > gh) {
ctop = 20;
cleft += w + 20;
}
} else {
cleft += w + 20;
if (cleft > gw) {
if (cleft + w > gw) {
cleft = 20;
ctop += h + 20;
}