phosphor-boxpanel
Advanced tools
Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
@@ -248,6 +248,8 @@ /*----------------------------------------------------------------------------- | ||
BoxLayout.prototype.attachChild = function (index, child) { | ||
BoxLayoutPrivate.addSizer(this, index); | ||
var sizers = BoxLayoutPrivate.sizersProperty.get(this); | ||
arrays.insert(sizers, index, new phosphor_boxengine_1.BoxSizer()); | ||
this.parent.node.appendChild(child.node); | ||
if (this.parent.isAttached) | ||
phosphor_messaging_1.sendMessage(child, phosphor_widget_1.Widget.MsgAfterAttach); | ||
this.parent.fit(); | ||
}; | ||
@@ -267,3 +269,5 @@ /** | ||
BoxLayout.prototype.moveChild = function (fromIndex, toIndex, child) { | ||
BoxLayoutPrivate.moveSizer(this, fromIndex, toIndex); | ||
var sizers = BoxLayoutPrivate.sizersProperty.get(this); | ||
arrays.move(sizers, fromIndex, toIndex); | ||
this.parent.update(); | ||
}; | ||
@@ -281,7 +285,9 @@ /** | ||
BoxLayout.prototype.detachChild = function (index, child) { | ||
var sizers = BoxLayoutPrivate.sizersProperty.get(this); | ||
arrays.removeAt(sizers, index); | ||
if (this.parent.isAttached) | ||
phosphor_messaging_1.sendMessage(child, phosphor_widget_1.Widget.MsgBeforeDetach); | ||
this.parent.node.removeChild(child.node); | ||
BoxLayoutPrivate.removeSizer(this, index); | ||
BoxLayoutPrivate.reset(child); | ||
BoxLayoutPrivate.resetGeometry(child); | ||
this.parent.fit(); | ||
}; | ||
@@ -448,2 +454,9 @@ /** | ||
/** | ||
* The property descriptor for the box layout sizers. | ||
*/ | ||
BoxLayoutPrivate.sizersProperty = new phosphor_properties_1.Property({ | ||
name: 'sizers', | ||
create: function () { return []; }, | ||
}); | ||
/** | ||
* The property descriptor for a widget stretch factor. | ||
@@ -477,32 +490,5 @@ */ | ||
/** | ||
* Add a sizer to the layout at the specified index. | ||
* Reset the layout geometry for the given child widget. | ||
*/ | ||
function addSizer(layout, index) { | ||
arrays.insert(sizersProperty.get(layout), index, new phosphor_boxengine_1.BoxSizer()); | ||
if (layout.parent) | ||
layout.parent.fit(); | ||
} | ||
BoxLayoutPrivate.addSizer = addSizer; | ||
/** | ||
* Move a sizer in the layout from one index to another. | ||
*/ | ||
function moveSizer(layout, fromIndex, toIndex) { | ||
arrays.move(sizersProperty.get(layout), fromIndex, toIndex); | ||
if (layout.parent) | ||
layout.parent.update(); | ||
} | ||
BoxLayoutPrivate.moveSizer = moveSizer; | ||
/** | ||
* Remove a sizer from the layout at the specified index. | ||
*/ | ||
function removeSizer(layout, index) { | ||
arrays.removeAt(sizersProperty.get(layout), index); | ||
if (layout.parent) | ||
layout.parent.fit(); | ||
} | ||
BoxLayoutPrivate.removeSizer = removeSizer; | ||
/** | ||
* Reset the layout modifications for the given child widget. | ||
*/ | ||
function reset(widget) { | ||
function resetGeometry(widget) { | ||
var rect = rectProperty.get(widget); | ||
@@ -519,3 +505,3 @@ var style = widget.node.style; | ||
} | ||
BoxLayoutPrivate.reset = reset; | ||
BoxLayoutPrivate.resetGeometry = resetGeometry; | ||
/** | ||
@@ -545,3 +531,3 @@ * Fit the layout to total size required by the child widgets. | ||
var dir = layout.direction; | ||
var sizers = sizersProperty.get(layout); | ||
var sizers = BoxLayoutPrivate.sizersProperty.get(layout); | ||
if (dir === Direction.LeftToRight || dir === Direction.RightToLeft) { | ||
@@ -637,3 +623,3 @@ minW = fixedSpace; | ||
var box = boxSizingProperty.get(parent); | ||
var sizers = sizersProperty.get(layout); | ||
var sizers = BoxLayoutPrivate.sizersProperty.get(layout); | ||
var fixedSpace = fixedSpaceProperty.get(layout); | ||
@@ -713,9 +699,2 @@ // Compute the actual layout bounds adjusted for border and padding. | ||
/** | ||
* A property descriptor for the box layout sizers. | ||
*/ | ||
var sizersProperty = new phosphor_properties_1.Property({ | ||
name: 'sizers', | ||
create: function () { return []; }, | ||
}); | ||
/** | ||
* A property descriptor for the box layout fixed spacing. | ||
@@ -722,0 +701,0 @@ */ |
{ | ||
"name": "phosphor-boxpanel", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "A Phosphor layout panel which arranges its children into a single row or column.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
41723
1027