@breakside/jskit 2021.46.0 → 2022.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Frameworks/DOM.jsframework/Info.json +2 -2
- package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
- package/Frameworks/FontKit.jsframework/Info.json +2 -2
- package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
- package/Frameworks/Foundation.jsframework/Info.json +2 -2
- package/Frameworks/Foundation.jsframework/JS/JSColor.js +9 -0
- package/Frameworks/Foundation.jsframework/JS/JSColorSpace.js +106 -20
- package/Frameworks/Foundation.jsframework/JS/JSMediaType.js +1 -1
- package/Frameworks/Foundation.jsframework/JS/JSTimer.js +6 -0
- package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
- package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
- package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
- package/Info.json +2 -2
- package/Node/io.breakside.jskit-bundle.js +2 -2
- package/Root/Frameworks/APIKit/APIRequest.js +99 -0
- package/Root/Frameworks/APIKit/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/CSSOM/Info.yaml +1 -1
- package/Root/Frameworks/ChartKit/Info.yaml +1 -1
- package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
- package/Root/Frameworks/DBKit/Info.yaml +1 -1
- package/Root/Frameworks/DOM/Info.yaml +1 -1
- package/Root/Frameworks/Dispatch/Info.yaml +1 -1
- package/Root/Frameworks/FontKit/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/Info.yaml +1 -1
- package/Root/Frameworks/Foundation/JSColor.js +9 -0
- package/Root/Frameworks/Foundation/JSColorSpace.js +106 -20
- package/Root/Frameworks/Foundation/JSMediaType.js +1 -1
- package/Root/Frameworks/Foundation/JSTimer.js +6 -0
- package/Root/Frameworks/ImageKit/IKColorProfile.js +1091 -0
- package/Root/Frameworks/ImageKit/IKColorSpace.js +49 -198
- package/Root/Frameworks/ImageKit/IKMatrix.js +124 -0
- package/Root/Frameworks/ImageKit/ImageKit.js +2 -0
- package/Root/Frameworks/ImageKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKit/Info.yaml +1 -1
- package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
- package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
- package/Root/Frameworks/PDFKit/Info.yaml +1 -1
- package/Root/Frameworks/QRKit/Info.yaml +1 -1
- package/Root/Frameworks/SearchKit/Info.yaml +1 -1
- package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/Info.yaml +1 -1
- package/Root/Frameworks/ServerKit/SKHTTPRequest.js +44 -0
- package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/TestKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/Info.yaml +1 -1
- package/Root/Frameworks/UIKit/UICollectionReusableView.js +91 -0
- package/Root/Frameworks/UIKit/UICollectionView.js +1254 -0
- package/Root/Frameworks/UIKit/UICollectionViewCell.js +121 -0
- package/Root/Frameworks/UIKit/UICollectionViewGridLayout.js +425 -0
- package/Root/Frameworks/UIKit/UICollectionViewLayout.js +82 -0
- package/Root/Frameworks/UIKit/UIColorWell.js +12 -1
- package/Root/Frameworks/UIKit/UIDisplayServer.js +5 -1
- package/Root/Frameworks/UIKit/UIKit.js +7 -0
- package/Root/Frameworks/UIKit/UILayer.js +3 -0
- package/Root/Frameworks/UIKit/UIListView.js +26 -11
- package/Root/Frameworks/UIKit/UIMenu.js +1 -1
- package/Root/Frameworks/UIKit/UIMenuView.js +5 -1
- package/Root/Frameworks/UIKit/UINavigationBar.js +2 -2
- package/Root/Frameworks/UIKit/UIPopupButton.js +31 -3
- package/Root/Frameworks/UIKit/UIScrollView.js +2 -0
- package/Root/Frameworks/UIKit/UISplitViewController.js +43 -9
- package/Root/Frameworks/UIKit/UITextField.js +3 -0
- package/Root/Frameworks/UIKit/UIView.js +3 -0
- package/Root/Frameworks/UIKit/UIViewController.js +11 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -201,6 +201,9 @@ JSClass("UILayer", JSObject, {
|
|
|
201
201
|
},
|
|
202
202
|
|
|
203
203
|
setTransform: function(transform){
|
|
204
|
+
if (transform.isEqual(this.model.transform)){
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
204
207
|
// When the transform changes, the frame needs to be recalculated. The position, however, does
|
|
205
208
|
// not change. The transform essentially defines a new relationship between the position and frame
|
|
206
209
|
this._addImplicitAnimationForKey('transform');
|
|
@@ -126,7 +126,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
126
126
|
if (typeof(reuse) === 'string'){
|
|
127
127
|
this.registerHeaderFooterClassForReuseIdentifier(JSClass.FromName(reuse), identifier);
|
|
128
128
|
}else{
|
|
129
|
-
this.
|
|
129
|
+
this.registerHeaderFooterClassForReuseIdentifier(JSClass.FromName(reuse.valueForKey('className')), identifier);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -140,7 +140,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
140
140
|
this._headersStickToTop = spec.valueForKey("headersStickToTop");
|
|
141
141
|
}
|
|
142
142
|
if (spec.containsKey("showsFocusRing")){
|
|
143
|
-
this.
|
|
143
|
+
this.showsFocusRing = spec.valueForKey("showsFocusRing");
|
|
144
144
|
}
|
|
145
145
|
if (spec.containsKey("listHeaderView")){
|
|
146
146
|
this.listHeaderView = spec.valueForKey("listHeaderView", UIView);
|
|
@@ -339,7 +339,6 @@ JSClass("UIListView", UIScrollView, {
|
|
|
339
339
|
var lastVisibleItem = this._visibleItems[this._visibleItems.length - 1];
|
|
340
340
|
var searcher = JSBinarySearcher(this._visibleItems, VisibleItem.cellIndexPathCompare);
|
|
341
341
|
var visibleSizeChanged = false;
|
|
342
|
-
var listView = this;
|
|
343
342
|
var contentSize = JSSize(this.contentSize);
|
|
344
343
|
var contentOffset = JSPoint(this.contentOffset);
|
|
345
344
|
|
|
@@ -391,13 +390,13 @@ JSClass("UIListView", UIScrollView, {
|
|
|
391
390
|
|
|
392
391
|
if (animator && visibleSizeChanged){
|
|
393
392
|
animator.addAnimations(function(){
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
});
|
|
393
|
+
this.contentSize = contentSize;
|
|
394
|
+
this.contentOffset = contentOffset;
|
|
395
|
+
this._layoutVisibleItems(this._visibleItems, y0);
|
|
396
|
+
}, this);
|
|
398
397
|
}else{
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
this.contentSize = contentSize;
|
|
399
|
+
this.contentOffset = contentOffset;
|
|
401
400
|
}
|
|
402
401
|
|
|
403
402
|
},
|
|
@@ -1604,6 +1603,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1604
1603
|
header.bounds = JSRect(JSPoint.Zero, rect.size);
|
|
1605
1604
|
header.position = JSPoint(rect.origin.x + header.bounds.size.width * header.anchorPoint.x, rect.origin.y + header.bounds.size.height * header.anchorPoint.y);
|
|
1606
1605
|
this._styler.updateHeader(header, section);
|
|
1606
|
+
header.setNeedsLayout();
|
|
1607
1607
|
return header;
|
|
1608
1608
|
},
|
|
1609
1609
|
|
|
@@ -1620,6 +1620,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1620
1620
|
footer.bounds = JSRect(JSPoint.Zero, rect.size);
|
|
1621
1621
|
footer.position = JSPoint(rect.origin.x + footer.bounds.size.width * footer.anchorPoint.x, rect.origin.y + footer.bounds.size.height * footer.anchorPoint.y);
|
|
1622
1622
|
this._styler.updateFooter(footer, section);
|
|
1623
|
+
footer.setNeedsLayout();
|
|
1623
1624
|
return footer;
|
|
1624
1625
|
},
|
|
1625
1626
|
|
|
@@ -2601,6 +2602,20 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2601
2602
|
return indexPaths;
|
|
2602
2603
|
},
|
|
2603
2604
|
|
|
2605
|
+
visibleCells: JSReadOnlyProperty(),
|
|
2606
|
+
|
|
2607
|
+
getVisibleCells: function(){
|
|
2608
|
+
var cells = [];
|
|
2609
|
+
var item;
|
|
2610
|
+
for (var i = 0, l = this._visibleItems.length; i < l; ++i){
|
|
2611
|
+
item = this._visibleItems[i];
|
|
2612
|
+
if (item.kind === VisibleItem.Kind.cell){
|
|
2613
|
+
cells.push(item.view);
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
return cells;
|
|
2617
|
+
},
|
|
2618
|
+
|
|
2604
2619
|
// --------------------------------------------------------------------
|
|
2605
2620
|
// MARK: - Scrolling
|
|
2606
2621
|
|
|
@@ -2789,7 +2804,7 @@ VisibleItemIterator.prototype = Object.create({}, {
|
|
|
2789
2804
|
value: function(){
|
|
2790
2805
|
var height;
|
|
2791
2806
|
var item;
|
|
2792
|
-
if (this.item !== null && this.item.
|
|
2807
|
+
if (this.item !== null && this.item.kind === VisibleItem.Kind.footer){
|
|
2793
2808
|
++this.section;
|
|
2794
2809
|
}
|
|
2795
2810
|
while (this.section < this.listView.__numberOfSections){
|
|
@@ -2810,7 +2825,7 @@ VisibleItemIterator.prototype = Object.create({}, {
|
|
|
2810
2825
|
item = new VisibleItem(VisibleItem.Kind.cell, JSRect(0, this.y, this.width, height), this.cellIterator.indexPath);
|
|
2811
2826
|
return item;
|
|
2812
2827
|
}
|
|
2813
|
-
if (this.item === null || this.item.section <= this.section){
|
|
2828
|
+
if (this.item === null || this.item.indexPath.section <= this.section){
|
|
2814
2829
|
height = this.listView._heightForFooterInSection(this.section);
|
|
2815
2830
|
if (height > 0){
|
|
2816
2831
|
item = new VisibleItem(VisibleItem.Kind.footer, JSRect(0, this.y, this.width, height), JSIndexPath([this.section]));
|
|
@@ -894,7 +894,7 @@ JSClass("UIMenuWindowStyler", UIMenuStyler, {
|
|
|
894
894
|
var item = menu.items[itemIndex];
|
|
895
895
|
var window = this.windowForMenu(menu);
|
|
896
896
|
if (window !== null){
|
|
897
|
-
return window.
|
|
897
|
+
return window.viewForItem(item);
|
|
898
898
|
}
|
|
899
899
|
return null;
|
|
900
900
|
}
|
|
@@ -214,7 +214,11 @@ JSClass("UIMenuWindow", UIWindow, {
|
|
|
214
214
|
},
|
|
215
215
|
|
|
216
216
|
viewForItem: function(item){
|
|
217
|
-
|
|
217
|
+
var index = this._itemViewIndexesByItemId[item.objectID];
|
|
218
|
+
if (index !== undefined){
|
|
219
|
+
return this.menuView.itemViews[index];
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
218
222
|
},
|
|
219
223
|
|
|
220
224
|
// -----------------------------------------------------------------------
|
|
@@ -490,9 +490,9 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
490
490
|
props.backBarItemView.alpha = 0;
|
|
491
491
|
var backTitleFrame = props.backBarItemView.titleLabel.convertRectToView(props.backBarItemView.titleLabel.bounds, props.backBarItemView.superview);
|
|
492
492
|
if (removingCustomView){
|
|
493
|
-
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(removingCustomView.frame.origin.x - backTitleFrame.origin.x, 0).scaledBy(backToTitleScale);
|
|
493
|
+
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingCustomView.frame.origin.x - backTitleFrame.origin.x), 0).scaledBy(backToTitleScale);
|
|
494
494
|
}else{
|
|
495
|
-
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(removingTitleLabel.frame.origin.x - backTitleFrame.origin.x, 0).scaledBy(backToTitleScale);
|
|
495
|
+
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingTitleLabel.frame.origin.x - backTitleFrame.origin.x), 0).scaledBy(backToTitleScale);
|
|
496
496
|
}
|
|
497
497
|
animator.addAnimations(function(){
|
|
498
498
|
var i, l;
|
|
@@ -467,18 +467,21 @@ JSClass("UIPopupButtonStyler", UIControlStyler, {
|
|
|
467
467
|
|
|
468
468
|
JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
469
469
|
|
|
470
|
-
showsOverState: false,
|
|
471
470
|
titleInsets: null,
|
|
472
471
|
normalBackgroundColor: null,
|
|
473
472
|
disabledBackgroundColor: null,
|
|
473
|
+
overBackgroundColor: null,
|
|
474
474
|
activeBackgroundColor: null,
|
|
475
475
|
normalBackgroundGradient: null,
|
|
476
|
+
overBackgroundGradient: null,
|
|
476
477
|
disabledBackgroundGradient: null,
|
|
477
478
|
activeBackgroundGradient: null,
|
|
478
479
|
normalBorderColor: null,
|
|
479
480
|
disabledBorderColor: null,
|
|
481
|
+
overBorderColor: null,
|
|
480
482
|
activeBorderColor: null,
|
|
481
483
|
normalTitleColor: null,
|
|
484
|
+
overTitleColor: null,
|
|
482
485
|
disabledTitleColor: null,
|
|
483
486
|
activeTitleColor: null,
|
|
484
487
|
borderWidth: 0,
|
|
@@ -508,7 +511,7 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
508
511
|
},
|
|
509
512
|
|
|
510
513
|
initWithSpec: function(spec){
|
|
511
|
-
UIPopupButtonCustomStyler.$super.initWithSpec(spec);
|
|
514
|
+
UIPopupButtonCustomStyler.$super.initWithSpec.call(this, spec);
|
|
512
515
|
|
|
513
516
|
this._populateDefaults();
|
|
514
517
|
|
|
@@ -518,6 +521,9 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
518
521
|
if (spec.containsKey("normalBackgroundColor")){
|
|
519
522
|
this.normalBackgroundColor = spec.valueForKey("normalBackgroundColor", JSColor);
|
|
520
523
|
}
|
|
524
|
+
if (spec.containsKey("overBackgroundColor")){
|
|
525
|
+
this.overBackgroundColor = spec.valueForKey("overBackgroundColor", JSColor);
|
|
526
|
+
}
|
|
521
527
|
if (spec.containsKey("disabledBackgroundColor")){
|
|
522
528
|
this.disabledBackgroundColor = spec.valueForKey("disabledBackgroundColor", JSColor);
|
|
523
529
|
}
|
|
@@ -527,6 +533,9 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
527
533
|
if (spec.containsKey("normalBackgroundGradient")){
|
|
528
534
|
this.normalBackgroundGradient = spec.valueForKey("normalBackgroundGradient", JSGradient);
|
|
529
535
|
}
|
|
536
|
+
if (spec.containsKey("overBackgroundGradient")){
|
|
537
|
+
this.overBackgroundGradient = spec.valueForKey("overBackgroundGradient", JSGradient);
|
|
538
|
+
}
|
|
530
539
|
if (spec.containsKey("disabledBackgroundGradient")){
|
|
531
540
|
this.disabledBackgroundGradient = spec.valueForKey("disabledBackgroundGradient", JSGradient);
|
|
532
541
|
}
|
|
@@ -536,6 +545,9 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
536
545
|
if (spec.containsKey("normalBorderColor")){
|
|
537
546
|
this.normalBorderColor = spec.valueForKey("normalBorderColor", JSColor);
|
|
538
547
|
}
|
|
548
|
+
if (spec.containsKey("overBorderColor")){
|
|
549
|
+
this.overBorderColor = spec.valueForKey("overBorderColor", JSColor);
|
|
550
|
+
}
|
|
539
551
|
if (spec.containsKey("disabledBorderColor")){
|
|
540
552
|
this.disabledBorderColor = spec.valueForKey("disabledBorderColor", JSColor);
|
|
541
553
|
}
|
|
@@ -545,6 +557,9 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
545
557
|
if (spec.containsKey("normalTitleColor")){
|
|
546
558
|
this.normalTitleColor = spec.valueForKey("normalTitleColor", JSColor);
|
|
547
559
|
}
|
|
560
|
+
if (spec.containsKey("overTitleColor")){
|
|
561
|
+
this.overTitleColor = spec.valueForKey("overTitleColor", JSColor);
|
|
562
|
+
}
|
|
548
563
|
if (spec.containsKey("disabledTitleColor")){
|
|
549
564
|
this.disabledTitleColor = spec.valueForKey("disabledTitleColor", JSColor);
|
|
550
565
|
}
|
|
@@ -595,6 +610,9 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
595
610
|
if (this.activeBorderColor === null){
|
|
596
611
|
this.activeBorderColor = this.normalBorderColor.colorDarkenedByPercentage(0.2);
|
|
597
612
|
}
|
|
613
|
+
if (this.overBorderColor === null){
|
|
614
|
+
this.overBorderColor = this.normalBorderColor.colorDarkenedByPercentage(0.2);
|
|
615
|
+
}
|
|
598
616
|
if (this.disabledBorderColor === null){
|
|
599
617
|
this.disabledBorderColor = this.normalBorderColor.colorWithAlpha(0.5);
|
|
600
618
|
}
|
|
@@ -602,6 +620,9 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
602
620
|
if (this.normalTitleColor === null){
|
|
603
621
|
this.normalTitleColor = JSColor.text;
|
|
604
622
|
}
|
|
623
|
+
if (this.overTitleColor === null){
|
|
624
|
+
this.overTitleColor = this.normalTitleColor.colorDarkenedByPercentage(0.2);
|
|
625
|
+
}
|
|
605
626
|
if (this.activeTitleColor === null){
|
|
606
627
|
this.activeTitleColor = this.normalTitleColor.colorDarkenedByPercentage(0.2);
|
|
607
628
|
}
|
|
@@ -628,6 +649,13 @@ JSClass("UIPopupButtonCustomStyler", UIPopupButtonStyler, {
|
|
|
628
649
|
button._titleLabel.textColor = this.disabledTitleColor;
|
|
629
650
|
button._imageView.templateColor = this.disabledTitleColor;
|
|
630
651
|
button._indicatorView.templateColor = this.disabledTitleColor;
|
|
652
|
+
}else if (button.over){
|
|
653
|
+
button.layer.backgroundColor = this.overBackgroundColor;
|
|
654
|
+
button.layer.backgroundGradient = this.overBackgroundGradient;
|
|
655
|
+
button.layer.borderColor = this.overBorderColor;
|
|
656
|
+
button._titleLabel.textColor = this.overTitleColor;
|
|
657
|
+
button._imageView.templateColor = this.overTitleColor;
|
|
658
|
+
button._indicatorView.templateColor = this.overTitleColor;
|
|
631
659
|
}else if (button.active){
|
|
632
660
|
button.layer.backgroundColor = this.activeBackgroundColor;
|
|
633
661
|
button.layer.backgroundGradient = this.activeBackgroundGradient;
|
|
@@ -766,7 +794,7 @@ JSClass("UIPopupButtonImageStyler", UIPopupButtonStyler, {
|
|
|
766
794
|
},
|
|
767
795
|
|
|
768
796
|
initWithSpec: function(spec){
|
|
769
|
-
UIPopupButtonCustomStyler.$super.initWithSpec(spec);
|
|
797
|
+
UIPopupButtonCustomStyler.$super.initWithSpec.call(this, spec);
|
|
770
798
|
if (spec.containsKey("normalColor")){
|
|
771
799
|
this.normalColor = spec.valueForKey("normalColor", JSColor);
|
|
772
800
|
}
|
|
@@ -276,6 +276,8 @@ JSClass('UIScrollView', UIView, {
|
|
|
276
276
|
|
|
277
277
|
_sanitizedOffset: function(offset){
|
|
278
278
|
offset = JSPoint(offset);
|
|
279
|
+
offset.x = Math.round(offset.x);
|
|
280
|
+
offset.y = Math.round(offset.y);
|
|
279
281
|
if (!this.scrollsHorizontally){
|
|
280
282
|
offset.x = this._contentOffset.x;
|
|
281
283
|
}else if (offset.x < this._minContentOffset.x){
|
|
@@ -148,22 +148,56 @@ JSClass("UISplitViewController", UIViewController, {
|
|
|
148
148
|
},
|
|
149
149
|
|
|
150
150
|
_setMainViewControllerCollapsed: function(mainViewController){
|
|
151
|
+
if (this._leadingViewController.isKindOfClass(UINavigationController)){
|
|
152
|
+
this._pushMainViewControllerOnNavigationController(mainViewController, this._leadingViewController);
|
|
153
|
+
}else{
|
|
154
|
+
this._presentMainViewControllerOnViewController(mainViewController, this._leadingViewController);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
_pushMainViewControllerOnNavigationController: function(mainViewController, navigationController){
|
|
159
|
+
var i = navigationController.viewControllers.length - 1;
|
|
160
|
+
// 1. Pop off all view controllers up to and including our current mainViewController
|
|
151
161
|
if (this._mainViewController !== null){
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this
|
|
162
|
+
while (i >= 1 && navigationController.viewControllers[i] !== this._mainViewController){
|
|
163
|
+
--i;
|
|
164
|
+
}
|
|
165
|
+
if (i > 0){
|
|
166
|
+
if (mainViewController === this._mainViewController){
|
|
167
|
+
// Bail if we're being asked to show the same view controller that's already shown
|
|
168
|
+
// NOTE: this check only comes after finding that the view controller
|
|
169
|
+
// is indeed part of the presentation tree becuase without a notification
|
|
170
|
+
// from the navigation controller when views are popped by the user,
|
|
171
|
+
// we may be in a situation where this._mainViewController is set, but
|
|
172
|
+
// is not part of the navigation stack
|
|
173
|
+
return;
|
|
159
174
|
}
|
|
175
|
+
navigationController.popToViewController(navigationController.viewControllers[i - 1], false);
|
|
160
176
|
}
|
|
161
|
-
|
|
177
|
+
}
|
|
178
|
+
// 2. Push the new new mainViewController, animating if we're not currently changing traits
|
|
179
|
+
if (mainViewController !== null){
|
|
180
|
+
navigationController.pushViewController(mainViewController, !this.isChangingTraits);
|
|
162
181
|
}
|
|
163
182
|
this._mainViewController = mainViewController;
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
_presentMainViewControllerOnViewController: function(mainViewController, viewController){
|
|
186
|
+
// Bail if we're being asked to show the same view controller that's already shown
|
|
187
|
+
if (mainViewController === this._mainViewController){
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
// 1. Dismiss the current mainViewController
|
|
164
191
|
if (this._mainViewController !== null){
|
|
165
|
-
|
|
192
|
+
if (this._mainViewController === viewController.presentedViewController){
|
|
193
|
+
viewController.dismiss();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// 2. Present the new mainViewController
|
|
197
|
+
if (mainViewController !== null){
|
|
198
|
+
viewController.presentViewController(mainViewController);
|
|
166
199
|
}
|
|
200
|
+
this._mainViewController = mainViewController;
|
|
167
201
|
},
|
|
168
202
|
|
|
169
203
|
getSplitView: function(){
|
|
@@ -788,6 +788,9 @@ JSClass("UITextField", UIControl, {
|
|
|
788
788
|
this.delegate.textFieldDidChange(this);
|
|
789
789
|
}
|
|
790
790
|
this._didChange = true;
|
|
791
|
+
if (this._textLayer.textAlignment !== JSTextAlignment.left){
|
|
792
|
+
this.setNeedsLayout();
|
|
793
|
+
}
|
|
791
794
|
},
|
|
792
795
|
|
|
793
796
|
_adjustCursorPositionToCenterIfNeeded: function(){
|
|
@@ -145,6 +145,9 @@ JSClass('UIView', UIResponder, {
|
|
|
145
145
|
this.addSubview(subview);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
if (spec.containsKey("clipsToBounds")){
|
|
149
|
+
this.clipsToBounds = spec.valueForKey("clipsToBounds");
|
|
150
|
+
}
|
|
148
151
|
// NOTE: constraints are still and work in progress, and aren't actually
|
|
149
152
|
// used yet during layout
|
|
150
153
|
if (spec.containsKey("constraints")){
|
|
@@ -162,6 +162,9 @@ JSClass("UIViewController", UIResponder, {
|
|
|
162
162
|
this._isViewVisible = false;
|
|
163
163
|
},
|
|
164
164
|
|
|
165
|
+
// -------------------------------------------------------------------------
|
|
166
|
+
// MARK: - Layout
|
|
167
|
+
|
|
165
168
|
viewDidLayoutSubviews: function(){
|
|
166
169
|
},
|
|
167
170
|
|
|
@@ -169,6 +172,11 @@ JSClass("UIViewController", UIResponder, {
|
|
|
169
172
|
this.view.sizeToFitSize(size);
|
|
170
173
|
},
|
|
171
174
|
|
|
175
|
+
contentSizeThatFitsSize: function(maxSize){
|
|
176
|
+
this.view.sizeToFitSize(maxSize);
|
|
177
|
+
return JSSize(this.view.bounds.size);
|
|
178
|
+
},
|
|
179
|
+
|
|
172
180
|
// -------------------------------------------------------------------------
|
|
173
181
|
// MARK: - Child View Controllers
|
|
174
182
|
|
|
@@ -193,6 +201,9 @@ JSClass("UIViewController", UIResponder, {
|
|
|
193
201
|
},
|
|
194
202
|
|
|
195
203
|
replaceChildViewController: function(previousChildViewController, childViewController, animator){
|
|
204
|
+
if (previousChildViewController === childViewController){
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
196
207
|
if (this.isViewLoaded && this.isViewVisible){
|
|
197
208
|
var animated = animator !== undefined && animator !== null;
|
|
198
209
|
if (previousChildViewController !== null){
|