bugfix
This commit is contained in:
parent
f1842722b4
commit
0a7c9fca0f
@ -303,7 +303,21 @@ var _buildWidget = async function(from_widget, target, mode, options, desc){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w.parent) return;
|
if (w.parent) {
|
||||||
|
if (target instanceof bricks.Popup || target instanceof bricks.PopupWindow){
|
||||||
|
target.destroy();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (target instanceof bricks.Popup || target instanceof bricks.PopupWindow) {
|
||||||
|
if (! target.parent){
|
||||||
|
bricks.app.add_widget(target);
|
||||||
|
}
|
||||||
|
console.log('target=', target);
|
||||||
|
if (desc.popup_options.eventpos){
|
||||||
|
target.bind('opened', bricks.relocate_by_eventpos.bind(null, desc.event, target));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mode == 'replace'){
|
if (mode == 'replace'){
|
||||||
target.clear_widgets();
|
target.clear_widgets();
|
||||||
@ -313,9 +327,8 @@ var _buildWidget = async function(from_widget, target, mode, options, desc){
|
|||||||
} else {
|
} else {
|
||||||
target.add_widget(w);
|
target.add_widget(w);
|
||||||
}
|
}
|
||||||
if ((target instanceof bricks.Popup || target instanceof bricks.PopupWindow) \
|
if (target instanceof bricks.Popup || target instanceof bricks.PopupWindow) {
|
||||||
&& desc.popup_options.eventpos){
|
target.open();
|
||||||
target.bind('opened', bricks.relocate_by_eventpos.bind(None, desc.event, target));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +356,7 @@ bricks.buildUrlwidgetHandler = function(w, target, rtdata, desc){
|
|||||||
"widgettype":"urlwidget",
|
"widgettype":"urlwidget",
|
||||||
"options":options
|
"options":options
|
||||||
}
|
}
|
||||||
return _buildWidget.bind(None, w, target, desc.mode || 'replace', opts, desc);
|
return _buildWidget.bind(null, w, target, desc.mode || 'replace', opts, desc);
|
||||||
}
|
}
|
||||||
bricks.buildBricksHandler = function(w, target, rtdata, desc){
|
bricks.buildBricksHandler = function(w, target, rtdata, desc){
|
||||||
var options = objcopy(desc.options||{});
|
var options = objcopy(desc.options||{});
|
||||||
|
@ -24,7 +24,19 @@ bricks.Menu = class extends bricks.VBox {
|
|||||||
console.log(event);
|
console.log(event);
|
||||||
let e = event.target;
|
let e = event.target;
|
||||||
let opts = event.params;
|
let opts = event.params;
|
||||||
var t = bricks.getWidgetById(this.target);
|
var t;
|
||||||
|
var popts;
|
||||||
|
if (this.target == 'PopupWindow'){
|
||||||
|
popts = bricks.get_popupwindow_default_options();
|
||||||
|
bricks.extend(popts, this.popup_options || {});
|
||||||
|
t = new bricks.PopupWindow(popts);
|
||||||
|
} else if (this.target == 'Popup'){
|
||||||
|
popts = bricks.get_popup_default_options();
|
||||||
|
bricks.extend(popts, this.popup_options || {});
|
||||||
|
t = new bricks.Popup(popts);
|
||||||
|
} else {
|
||||||
|
t = bricks.getWidgetById(this.target);
|
||||||
|
}
|
||||||
if (t){
|
if (t){
|
||||||
var desc = {
|
var desc = {
|
||||||
"widgettype":"urlwidget",
|
"widgettype":"urlwidget",
|
||||||
|
@ -72,7 +72,7 @@ bricks.Popup = class extends bricks.VBox {
|
|||||||
set_dismiss_events(w){
|
set_dismiss_events(w){
|
||||||
if (!this.dismiss_events) return;
|
if (!this.dismiss_events) return;
|
||||||
this.dismiss_events.forEach(ename => {
|
this.dismiss_events.forEach(ename => {
|
||||||
w.bind(ename, this.distroy.bind(this));
|
w.bind(ename, this.destroy.bind(this));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
bring_to_top(){
|
bring_to_top(){
|
||||||
@ -284,6 +284,9 @@ bricks.Popup = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
open(){
|
open(){
|
||||||
|
if (!this.parent){
|
||||||
|
bricks.app.add_widget(this);
|
||||||
|
}
|
||||||
var rect, w, h;
|
var rect, w, h;
|
||||||
if (this.opened) {
|
if (this.opened) {
|
||||||
return;
|
return;
|
||||||
@ -341,7 +344,10 @@ bricks.Popup = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
add_widget(w, i){
|
add_widget(w, i){
|
||||||
this.set_dismiss_events(w);
|
this.set_dismiss_events(w);
|
||||||
return this.content_w.add_widget(w, i);
|
this.content_w.add_widget(w, i);
|
||||||
|
if (this.auto_open){
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
remove_widget(w){
|
remove_widget(w){
|
||||||
return this.content_w.remove_widget(w);
|
return this.content_w.remove_widget(w);
|
||||||
@ -455,15 +461,6 @@ bricks.PopupWindow = class extends bricks.Popup {
|
|||||||
}
|
}
|
||||||
super.dismiss()
|
super.dismiss()
|
||||||
}
|
}
|
||||||
add_widget(w, i){
|
|
||||||
return this.content_w.add_widget(w, i);
|
|
||||||
}
|
|
||||||
remove_widget(w){
|
|
||||||
return this.content_w.remove_widget(w);
|
|
||||||
}
|
|
||||||
clear_widgets(){
|
|
||||||
return this.content_w.clear_widgets();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
bricks.Dock = class extends bricks.HBox {
|
bricks.Dock = class extends bricks.HBox {
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
var bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.bug = false;
|
bricks.bug = false;
|
||||||
|
|
||||||
var bricks.relocate_by_eventpos = function(event, widget){
|
bricks.relocate_by_eventpos = function(event, widget){
|
||||||
var ex,ey;
|
var ex,ey;
|
||||||
var x,y;
|
var x,y;
|
||||||
var xsize = bricks.Body.dom_element.clientWidth;
|
var xsize = bricks.Body.dom_element.clientWidth;
|
||||||
|
Loading…
Reference in New Issue
Block a user