From bd4a7c1f02d1cade8302bde00ad85ea28175e89b Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 29 Oct 2024 14:29:02 +0800 Subject: [PATCH] bugfix --- bricks/bricks.js | 1 + bricks/css/bricks.css | 23 ++++--- bricks/menu.js | 6 +- bricks/popup.js | 143 +++++++++++++++++++++++++++++++++++++----- bricks/widget.js | 17 +++++ 5 files changed, 161 insertions(+), 29 deletions(-) diff --git a/bricks/bricks.js b/bricks/bricks.js index 6eeb33a..75f7fe3 100755 --- a/bricks/bricks.js +++ b/bricks/bricks.js @@ -460,6 +460,7 @@ bricks.App = class extends bricks.Layout { */ super(opts); bricks.app = this; + this.docks = []; bricks.bug = opts.debug || false; bricks.Body = this; this.deviceid = bricks.deviceid(opts.appname || 'appname'); diff --git a/bricks/css/bricks.css b/bricks/css/bricks.css index 605ca18..f026bc2 100755 --- a/bricks/css/bricks.css +++ b/bricks/css/bricks.css @@ -46,6 +46,17 @@ body { grid-gap: 1px; } +.popup { + display:none; + position: absolute; + box-sizing: border-box; /* 包括边框在内计算宽度和高度 */ + color: #111111; + background-color: #f1f1f1; + border: 1px solid #c1c1c1; + border-radius: 5px; + padding: 4px; +} + .modal { display:none; position: absolute; @@ -210,16 +221,8 @@ body { .multicolumns { column-width: 340px; - colomn-gap: 10px'; - overflow-x:none; -} - -.popup { - display: none; - position: absolution; - box-sizing: border-box; /* 包括边框在内计算宽度和高度 */ - background-color: #f1f1f1; - border: 1px solid #c1c1c1; + colomn-gap: 10px; + overflow-x: none; } .selected_record { diff --git a/bricks/menu.js b/bricks/menu.js index 85f5872..85b80a0 100755 --- a/bricks/menu.js +++ b/bricks/menu.js @@ -24,11 +24,6 @@ bricks.Menu = class extends bricks.VBox { console.log(event); let e = event.target; let opts = event.params; - if (! opts.url){ - console.log('itme.url is null'); - this.dispatch('command', opts); - return; - } var t = bricks.getWidgetById(this.target); if (t){ var desc = { @@ -47,6 +42,7 @@ bricks.Menu = class extends bricks.VBox { } else { console.log('menu_clicked():', this.target, 'not found') } + this.dispatch('command', opts); } create_children(w, items){ for (let i=0;i { + if (o == this){ + } + }); + if (! f){ + bricks.app.docks.push(this); + } + super.open(); + } + dismiss(){ + var f = bricks.app.docks.find(o=> o===this); + if (!f){ + bricks.app.docks.push(this); + } + super.dismiss() } } bricks.Factory.register('Popup', bricks.Popup); +bricks.Factory.register('PopupWindow', bricks.PopupWindow); diff --git a/bricks/widget.js b/bricks/widget.js index 84683a4..ef72f5e 100755 --- a/bricks/widget.js +++ b/bricks/widget.js @@ -153,6 +153,23 @@ bricks.JsWidget = class { } } } + enter_fullscreen(){ + var e = this.dom_element; + // 获取要全屏显示的元素 + // 检查浏览器是否支持Fullscreen API + if (e.requestFullscreen) { + e.requestFullscreen(); + } else if (e.mozRequestFullScreen) { // Firefox + e.mozRequestFullScreen(); + } else if (e.webkitRequestFullscreen) { // Chrome, Safari and Opera + e.webkitRequestFullscreen(); + } else if (e.msRequestFullscreen) { // IE/Edge + e.msRequestFullscreen(); + } + } + exit_fullscreen(){ + document.exitFullscreen(); + } h_center(){ this.dom_element.style.marginLeft = 'auto'; this.dom_element.style.marginRight = 'auto';