phosphor-splitpanel
Advanced tools
Comparing version
@@ -22,14 +22,2 @@ import { Message } from 'phosphor-messaging'; | ||
/** | ||
* The class name added to SplitPanel instances. | ||
*/ | ||
static p_SplitPanel: string; | ||
/** | ||
* The class name added to horizontal split panels. | ||
*/ | ||
static p_mod_horizontal: string; | ||
/** | ||
* The class name added to vertical split panels. | ||
*/ | ||
static p_mod_vertical: string; | ||
/** | ||
* A convenience alias of the `Horizontal` [[Orientation]]. | ||
@@ -52,10 +40,10 @@ */ | ||
/** | ||
* The property descriptor for the split panel handle size. | ||
* The property descriptor for the split panel spacing. | ||
* | ||
* The controls the size of the split handles placed between the | ||
* children of the panel, in pixels. The default value is `3`. | ||
* The controls the fixed spacing between the child widgets, in | ||
* pixels. The default value is `3`. | ||
* | ||
* **See also:** [[handleSize]] | ||
* **See also:** [[spacing]] | ||
*/ | ||
static handleSizeProperty: Property<SplitPanel, number>; | ||
static spacingProperty: Property<SplitPanel, number>; | ||
/** | ||
@@ -115,14 +103,14 @@ * The property descriptor for a widget stretch factor. | ||
/** | ||
* Get the size of the split handles. | ||
* Get the inter-element spacing for the split panel. | ||
* | ||
* #### Notes | ||
* This is a pure delegate to the [[handleSizeProperty]]. | ||
* This is a pure delegate to the [[spacingProperty]]. | ||
*/ | ||
/** | ||
* Set the the size of the split handles. | ||
* Set the inter-element spacing for the split panel. | ||
* | ||
* #### Notes | ||
* This is a pure delegate to the [[handleSizeProperty]]. | ||
* This is a pure delegate to the [[spacingProperty]]. | ||
*/ | ||
handleSize: number; | ||
spacing: number; | ||
/** | ||
@@ -129,0 +117,0 @@ * Get the normalized sizes of the widgets in the panel. |
112
lib/index.js
@@ -23,2 +23,26 @@ /*----------------------------------------------------------------------------- | ||
/** | ||
* The class name added to SplitPanel instances. | ||
*/ | ||
var SPLIT_PANEL_CLASS = 'p-SplitPanel'; | ||
/** | ||
* The class name added to SplitHandle instances. | ||
*/ | ||
var SPLIT_HANDLE_CLASS = 'p-SplitHandle'; | ||
/** | ||
* The class name added to a split handle overlay. | ||
*/ | ||
var OVERLAY_CLASS = 'p-SplitHandle-overlay'; | ||
/** | ||
* The class name added to horizontal split panels and handles. | ||
*/ | ||
var HORIZONTAL_CLASS = 'p-mod-horizontal'; | ||
/** | ||
* The class name added to vertical split panels and handles. | ||
*/ | ||
var VERTICAL_CLASS = 'p-mod-vertical'; | ||
/** | ||
* The class name added to hidden split handles. | ||
*/ | ||
var HIDDEN_CLASS = 'p-mod-hidden'; | ||
/** | ||
* The layout orientation of a split panel. | ||
@@ -51,4 +75,4 @@ */ | ||
this._pressData = null; | ||
this.addClass(SplitPanel.p_SplitPanel); | ||
this.addClass(SplitPanel.p_mod_horizontal); | ||
this.addClass(SPLIT_PANEL_CLASS); | ||
this.addClass(HORIZONTAL_CLASS); | ||
} | ||
@@ -111,20 +135,20 @@ /** | ||
}); | ||
Object.defineProperty(SplitPanel.prototype, "handleSize", { | ||
Object.defineProperty(SplitPanel.prototype, "spacing", { | ||
/** | ||
* Get the size of the split handles. | ||
* Get the inter-element spacing for the split panel. | ||
* | ||
* #### Notes | ||
* This is a pure delegate to the [[handleSizeProperty]]. | ||
* This is a pure delegate to the [[spacingProperty]]. | ||
*/ | ||
get: function () { | ||
return SplitPanel.handleSizeProperty.get(this); | ||
return SplitPanel.spacingProperty.get(this); | ||
}, | ||
/** | ||
* Set the the size of the split handles. | ||
* Set the inter-element spacing for the split panel. | ||
* | ||
* #### Notes | ||
* This is a pure delegate to the [[handleSizeProperty]]. | ||
* This is a pure delegate to the [[spacingProperty]]. | ||
*/ | ||
set: function (size) { | ||
SplitPanel.handleSizeProperty.set(this, size); | ||
SplitPanel.spacingProperty.set(this, size); | ||
}, | ||
@@ -299,3 +323,3 @@ enumerable: true, | ||
lastVisibleHandle.hidden = true; | ||
this._fixedSpace = this.handleSize * Math.max(0, visibleCount - 1); | ||
this._fixedSpace = this.spacing * Math.max(0, visibleCount - 1); | ||
// Compute new size constraints for the split panel. | ||
@@ -394,3 +418,3 @@ var minW = 0; | ||
// Distribute the layout space and layout the items. | ||
var handleSize = this.handleSize; | ||
var spacing = this.spacing; | ||
if (horizontal) { | ||
@@ -408,5 +432,5 @@ phosphor_boxengine_1.boxCalc(this._sizers, Math.max(0, width - this._fixedSpace)); | ||
hStyle.left = left + size + 'px'; | ||
hStyle.width = handleSize + 'px'; | ||
hStyle.width = spacing + 'px'; | ||
hStyle.height = height + 'px'; | ||
left += size + handleSize; | ||
left += size + spacing; | ||
} | ||
@@ -427,4 +451,4 @@ } | ||
hStyle.width = width + 'px'; | ||
hStyle.height = handleSize + 'px'; | ||
top += size + handleSize; | ||
hStyle.height = spacing + 'px'; | ||
top += size + spacing; | ||
} | ||
@@ -558,19 +582,7 @@ } | ||
SplitPanel.prototype._onOrientationChanged = function (old, value) { | ||
this.toggleClass(SplitPanel.p_mod_horizontal, value === Orientation.Horizontal); | ||
this.toggleClass(SplitPanel.p_mod_vertical, value === Orientation.Vertical); | ||
this.toggleClass(HORIZONTAL_CLASS, value === Orientation.Horizontal); | ||
this.toggleClass(VERTICAL_CLASS, value === Orientation.Vertical); | ||
phosphor_messaging_1.postMessage(this, phosphor_widget_1.MSG_LAYOUT_REQUEST); | ||
}; | ||
/** | ||
* The class name added to SplitPanel instances. | ||
*/ | ||
SplitPanel.p_SplitPanel = 'p-SplitPanel'; | ||
/** | ||
* The class name added to horizontal split panels. | ||
*/ | ||
SplitPanel.p_mod_horizontal = 'p-mod-horizontal'; | ||
/** | ||
* The class name added to vertical split panels. | ||
*/ | ||
SplitPanel.p_mod_vertical = 'p-mod-vertical'; | ||
/** | ||
* A convenience alias of the `Horizontal` [[Orientation]]. | ||
@@ -596,10 +608,10 @@ */ | ||
/** | ||
* The property descriptor for the split panel handle size. | ||
* The property descriptor for the split panel spacing. | ||
* | ||
* The controls the size of the split handles placed between the | ||
* children of the panel, in pixels. The default value is `3`. | ||
* The controls the fixed spacing between the child widgets, in | ||
* pixels. The default value is `3`. | ||
* | ||
* **See also:** [[handleSize]] | ||
* **See also:** [[spacing]] | ||
*/ | ||
SplitPanel.handleSizeProperty = new phosphor_properties_1.Property({ | ||
SplitPanel.spacingProperty = new phosphor_properties_1.Property({ | ||
value: 3, | ||
@@ -638,4 +650,4 @@ coerce: function (owner, value) { return Math.max(0, value | 0); }, | ||
this._orientation = Orientation.Horizontal; | ||
this.addClass(SplitHandle.p_SplitHandle); | ||
this.addClass(SplitHandle.p_mod_horizontal); | ||
this.addClass(SPLIT_HANDLE_CLASS); | ||
this.addClass(HORIZONTAL_CLASS); | ||
} | ||
@@ -648,3 +660,3 @@ /** | ||
var overlay = document.createElement('div'); | ||
overlay.className = SplitHandle.p_SplitHandle_overlay; | ||
overlay.className = OVERLAY_CLASS; | ||
node.appendChild(overlay); | ||
@@ -668,3 +680,3 @@ return node; | ||
this._hidden = hidden; | ||
this.toggleClass(SplitHandle.p_mod_hidden, hidden); | ||
this.toggleClass(HIDDEN_CLASS, hidden); | ||
}, | ||
@@ -689,4 +701,4 @@ enumerable: true, | ||
this._orientation = value; | ||
this.toggleClass(SplitHandle.p_mod_horizontal, value === Orientation.Horizontal); | ||
this.toggleClass(SplitHandle.p_mod_vertical, value === Orientation.Vertical); | ||
this.toggleClass(HORIZONTAL_CLASS, value === Orientation.Horizontal); | ||
this.toggleClass(VERTICAL_CLASS, value === Orientation.Vertical); | ||
}, | ||
@@ -696,22 +708,2 @@ enumerable: true, | ||
}); | ||
/** | ||
* The class name added to SplitHandle instances. | ||
*/ | ||
SplitHandle.p_SplitHandle = 'p-SplitHandle'; | ||
/** | ||
* The class name added to a split handle overlay. | ||
*/ | ||
SplitHandle.p_SplitHandle_overlay = 'p-SplitHandle-overlay'; | ||
/** | ||
* The class name added to hidden split handles. | ||
*/ | ||
SplitHandle.p_mod_hidden = 'p-mod-hidden'; | ||
/** | ||
* The class name added to horizontal split handles. | ||
*/ | ||
SplitHandle.p_mod_horizontal = 'p-mod-horizontal'; | ||
/** | ||
* The class name added to vertical split handles. | ||
*/ | ||
SplitHandle.p_mod_vertical = 'p-mod-vertical'; | ||
return SplitHandle; | ||
@@ -718,0 +710,0 @@ })(phosphor_nodewrapper_1.NodeWrapper); |
{ | ||
"name": "phosphor-splitpanel", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"description": "A Phosphor layout widget which arranges its children into resizable sections.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
44846
-1.92%1110
-1.77%