Comments and cleanups

This commit is contained in:
vakrilov
2016-01-26 11:20:15 +02:00
parent 216cfb11de
commit d1676ca366
2 changed files with 7 additions and 8 deletions

View File

@ -1,4 +1,5 @@
import viewCommon = require("./view-common");
import types = require("utils/types");
import viewCommon = require("./view-common");
import trace = require("trace");
import utils = require("utils/utils");
import dependencyObservable = require("ui/core/dependency-observable");
@ -269,8 +270,6 @@ export class View extends viewCommon.View {
public _addToSuperview(superview: any, atIndex?: number): boolean {
if (superview && this._nativeView) {
var types = require("utils/types");
if (types.isNullOrUndefined(atIndex) || atIndex >= superview.subviews.count) {
superview.addSubview(this._nativeView);
} else {

View File

@ -4,18 +4,18 @@ import definition = require("ui/proxy-view-container");
import trace = require("trace");
import layout = require("ui/layouts/layout-base");
/**
* Proxy view container that adds all its native children dirctly to the parent.
* Proxy view container that adds all its native children directly to the parent.
* To be used as a logical grouping container of views.
*/
// Cases to cover:
// * Child is added to the attached proxy. Handled in _addViewToNativeVisualTree.
// * Proxy (with children) is added to the DOM.
// - IOS: Handled in _addToSuperview - when the proxy is added, it adds all its children to the new parent.
// - Android: _onAttached calls _addViewToNativeVisualTree recoursively when the proxy is added to the parent.
// - Android: _onAttached calls _addViewToNativeVisualTree recursively when the proxy is added to the parent.
// * Child is removed from attached proxy. Handled in _removeViewFromNativeVisualTree.
// * Proxy (with children) is removed form the DOM.
// - IOS: Handled in _removeFromSuperview - when the proxy is removed, it removes all its children from its parent.
// - Android: _onDetached calls _removeViewFromNativeVisualTree recoursively when the proxy is removed from its parent.
// - Android: _onDetached calls _removeViewFromNativeVisualTree recursively when the proxy is removed from its parent.
export class ProxyViewContainer extends layout.LayoutBase implements definition.ProxyViewContainer {
// No native view for proxy container.
get ios(): any {
@ -60,8 +60,8 @@ export class ProxyViewContainer extends layout.LayoutBase implements definition.
let baseIndex = 0;
let insideIndex = 0;
if (parent instanceof layout.LayoutBase) {
baseIndex = parent.getChildIndex(this);
baseIndex = parent._childIndexToNativeChildIndex(baseIndex);
// Get my index in parent and convert it to native index.
baseIndex = parent._childIndexToNativeChildIndex(parent.getChildIndex(this));
}
if (types.isDefined(atIndex)) {