-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Description
All Flame-views inherit from Ember.ContainerView.
In Ember.ContainerView#init there are the following lines:
if ('string' === typeof viewName) {
view = get(this, viewName);
view = this.createChildView(view);
set(this, viewName, view);
} else {
view = this.createChildView(viewName);
}Currently, for controls at least, this causes three calls to createChildView: first by the getter, then the direct call to createChildView and at last, the setter also causes a call (see https://github.com/flamejs/flame.js/blob/master/views/form_view.js#L80).
Simply changing control to a normal property does not seem to work ([1]). So on what preconditions am I stepping on and how should this be done correctly?
[1] Simple modification to use simple property instead of a computed property.
var view = {
layout: { left: this.get('leftMargin'), right: this.get('rightMargin') },
layoutManager: Flame.VerticalStackLayoutManager.create({ topMargin: this._focusRingMargin, spacing: 0, bottomMargin: this._focusRingMargin }),
childViews: ['label', 'control'],
isVisible: descriptor.get('isVisible') === undefined ? true : descriptor.get('isVisible'),
label: this._buildLabel(descriptor),
control: control
};
view.control.layout = view.control.layout || {};
view.control.layout.left = formView.labelWidth + formView.columnSpacing;
view.control.layout.left.right = formView._focusRingMargin;