public/skyline/javascripts/src/skyline/src/layout.js in skylinecms-3.1.0 vs public/skyline/javascripts/src/skyline/src/layout.js in skylinecms-3.2.0
- old
+ new
@@ -6,10 +6,11 @@
Element Data options:
data-panel-hidden - "true","false"
data-panel-height -
data-panel-width -
+ data-panel-position -
Events:
afterSetup - Fires after the layout has been set up.
resize - Fires after the panel has been resized.
@@ -38,10 +39,11 @@
this.parent = null;
this.hidden = false;
this.addSplitterBeforeNext = false;
var o = arguments[1] || {};
+ o = Object.merge(o, this.getElementDataOptions());
if(o.width){ o.autoWidth = false; } else { o.autoWidth = true; }
if(o.height){ o.autoHeight = false; } else { o.autoHeight = true; }
if(this.element.parentNode.tagName == 'BODY' && (o.autoHeight || o.autoWidth)){
@@ -58,21 +60,21 @@
this.setOptions(o);
this.initializeElement();
this.cacheOffsets();
},
- setElementDataOptions : function(){
- var optionKeys = ["hidden", "width", "height"];
+ getElementDataOptions : function(){
+ var optionKeys = ["hidden", "width", "height", "position"];
var options = {};
var el = this.element;
optionKeys.each(function(k){
var prop = el.getProperty("data-panel-" + k);
if(prop){ options[k] = prop }
});
-
- this.setOptions(options);
+
+ return options;
},
/*
Function: addPanel(element)
Add a new panel to this layout (a panel is just another layout)
@@ -262,11 +264,10 @@
this.initializeElement();
this.panels.each(function(p){ p.restore(); });
},
// Setup the attached element.
initializeElement : function(){
- this.setElementDataOptions();
if(this.options.hidden){
this.hide(true);
} else {
this.show(true);
@@ -336,12 +337,12 @@
panel.width = size;
panel.element.setStyle("width", size);
},
setupWidths : function(){
var width = this.width - this.offsets.width;
- if(width < 0) { width = 0; }
-
+ if(width < 0 || isNaN(width)) { width = 0; }
+
this.element.setStyle("width",width);
var rest = width;
var variablePanel = null;
this.panels.each(function(panel){
if(panel.hidden){ return; }
@@ -349,11 +350,11 @@
if(panel.options.width == "content"){
panel.element.setStyle("width","auto");
panel.width = panel.element.offsetWidth;
} else {
panel.width = panel.options.width;
- }
+ }
rest = rest - panel.width;
this.setPanelSize(panel,panel.width);
panel.setupWidths();
} else {
variablePanel = panel;
@@ -365,11 +366,11 @@
}
},
setupHeights : function(){
var height = this.height - this.offsets.height;
- if(height < 0){ height = 0; }
+ if(height < 0 || isNaN(height)){ height = 0; }
this.element.setStyle("height",height);
this.panels.each(function(panel){
if(panel.hidden){ return; }
panel.height = height;
@@ -400,22 +401,22 @@
panel.element.setStyle("height", size);
},
setupWidths : function(){
var width = this.width - this.offsets.width;
- if(width < 0) { width = 0; }
-
+ if(width < 0 || isNaN(width)) { width = 0; }
+
this.element.setStyle("width", width);
this.panels.each(function(panel){
if(panel.hidden){ return; }
panel.width = width;
panel.setupWidths();
}.bind(this));
},
setupHeights : function(){
var height = this.height - this.offsets.height;
- if(height < 0){ height = 0; }
+ if(height < 0 || isNaN(height)){ height = 0; }
this.element.setStyle("height",height);
var rest = height;
if(this.panels.length > 0){
var variablePanel = null;
\ No newline at end of file