@breakside/jskit 2022.26.0 → 2022.29.0
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/JSFileManager+HTML.js +29 -19
- package/Frameworks/Foundation.jsframework/JS/JSUserDefaults.js +2 -2
- 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/Info.yaml +1 -1
- package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/Info.yaml +1 -1
- package/Root/Frameworks/AuthKit/OAService.js +8 -0
- package/Root/Frameworks/AuthKit/Services.yaml +2 -0
- 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/JSFileManager+HTML.js +29 -19
- package/Root/Frameworks/Foundation/JSUserDefaults.js +2 -2
- 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/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/UIApplication.js +33 -15
- package/Root/Frameworks/UIKit/UICheckbox.js +15 -8
- package/Root/Frameworks/UIKit/UICollectionView.js +2 -2
- package/Root/Frameworks/UIKit/UIDisplayServer.js +51 -10
- package/Root/Frameworks/UIKit/UIKit.js +1 -0
- package/Root/Frameworks/UIKit/UILayer.js +3 -0
- package/Root/Frameworks/UIKit/UIListView.js +10 -6
- package/Root/Frameworks/UIKit/UIMenuView.js +77 -18
- package/Root/Frameworks/UIKit/UINavigationBar.js +45 -22
- package/Root/Frameworks/UIKit/UIScrollView.js +26 -6
- package/Root/Frameworks/UIKit/UIState.js +6 -4
- package/Root/Frameworks/UIKit/UITextField.js +8 -1
- package/Root/Frameworks/UIKit/UIView.js +11 -0
- package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
- package/package.json +1 -1
|
@@ -400,31 +400,49 @@ JSClass('UIApplication', UIResponder, {
|
|
|
400
400
|
|
|
401
401
|
// MARK: - Touch Event Conversion
|
|
402
402
|
|
|
403
|
+
convertsTouchesToMouseEvents: false,
|
|
404
|
+
|
|
403
405
|
touchesBegan: function(touches, event){
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
if (this.convertsTouchesToMouseEvents){
|
|
407
|
+
// The application should be the final responder, so if a touch gets
|
|
408
|
+
// all the way here, it means nothing handled it, and we should try
|
|
409
|
+
// to re-send it as a mouse event to see if something handles that
|
|
410
|
+
var touch = touches[0];
|
|
411
|
+
var location = touch.window.convertPointToScreen(touch.locationInWindow);
|
|
412
|
+
this.windowServer.createMouseEvent(UIEvent.Type.leftMouseDown, event.timestamp, location);
|
|
413
|
+
}else{
|
|
414
|
+
UIApplication.$super.touchesBegan.call(this, touches, event);
|
|
415
|
+
}
|
|
410
416
|
},
|
|
411
417
|
|
|
412
418
|
touchesMoved: function(touches, event){
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
419
|
+
if (this.convertsTouchesToMouseEvents){
|
|
420
|
+
var touch = touches[0];
|
|
421
|
+
var location = touch.window.convertPointToScreen(touch.locationInWindow);
|
|
422
|
+
this.windowServer.createMouseEvent(UIEvent.Type.leftMouseDragged, event.timestamp, location);
|
|
423
|
+
}else{
|
|
424
|
+
UIApplication.$super.touchesMoved.call(this, touches, event);
|
|
425
|
+
}
|
|
416
426
|
},
|
|
417
427
|
|
|
418
428
|
touchesEnded: function(touches, event){
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
429
|
+
if (this.convertsTouchesToMouseEvents){
|
|
430
|
+
var touch = touches[0];
|
|
431
|
+
var location = touch.window.convertPointToScreen(touch.locationInWindow);
|
|
432
|
+
this.windowServer.createMouseEvent(UIEvent.Type.leftMouseUp, event.timestamp, location);
|
|
433
|
+
}else{
|
|
434
|
+
UIApplication.$super.touchesEnded.call(this, touches, event);
|
|
435
|
+
}
|
|
422
436
|
},
|
|
423
437
|
|
|
424
438
|
touchesCanceled: function(touches, event){
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
439
|
+
if (this.convertsTouchesToMouseEvents){
|
|
440
|
+
var touch = touches[0];
|
|
441
|
+
var location = touch.window.convertPointToScreen(touch.locationInWindow);
|
|
442
|
+
this.windowServer.createMouseEvent(UIEvent.Type.leftMouseUp, event.timestamp, location);
|
|
443
|
+
}else{
|
|
444
|
+
UIApplication.$super.touchesCanceled.call(this, touches, event);
|
|
445
|
+
}
|
|
428
446
|
},
|
|
429
447
|
|
|
430
448
|
// MARK: - Fonts
|
|
@@ -323,17 +323,24 @@ JSClass("UICheckboxDefaultStyler", UICheckboxStyler, {
|
|
|
323
323
|
|
|
324
324
|
sizeControlToFitSize: function(checkbox, maxSize){
|
|
325
325
|
var height = checkbox._titleLabel.font.displayLineHeight;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
326
|
+
if (checkbox._titleLabel.text !== ""){
|
|
327
|
+
var maxTitleSize = JSSize(maxSize);
|
|
328
|
+
var boxWidth = height + this.titleSpacing;
|
|
329
|
+
maxTitleSize.width -= boxWidth;
|
|
330
|
+
checkbox._titleLabel.sizeToFitSize(maxTitleSize);
|
|
331
|
+
checkbox.bounds = JSRect(0, 0, boxWidth + checkbox._titleLabel.frame.size.width, height);
|
|
332
|
+
}
|
|
333
|
+
checkbox.bounds = JSRect(0, 0, height, height);
|
|
331
334
|
},
|
|
332
335
|
|
|
333
336
|
intrinsicSizeOfControl: function(checkbox){
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
if (checkbox._titleLabel.text !== ""){
|
|
338
|
+
var size = JSSize(checkbox._titleLabel.intrinsicSize);
|
|
339
|
+
size.width += size.height + this.titleSpacing;
|
|
340
|
+
return size;
|
|
341
|
+
}
|
|
342
|
+
var height = checkbox._titleLabel.font.displayLineHeight;
|
|
343
|
+
return JSSize(height, height);
|
|
337
344
|
},
|
|
338
345
|
|
|
339
346
|
focusRingPathForControl: function(checkbox){
|
|
@@ -1009,7 +1009,7 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
1009
1009
|
return;
|
|
1010
1010
|
}
|
|
1011
1011
|
this._touch = {
|
|
1012
|
-
location0: touches[0].
|
|
1012
|
+
location0: touches[0].locationInWindow,
|
|
1013
1013
|
cell: null,
|
|
1014
1014
|
timer: JSTimer.scheduledTimerWithInterval(0.05, function(){
|
|
1015
1015
|
this._touch.timer = null;
|
|
@@ -1021,7 +1021,7 @@ JSClass("UICollectionView", UIScrollView, {
|
|
|
1021
1021
|
touchesMoved: function(touches, event){
|
|
1022
1022
|
UICollectionView.$super.touchesMoved.call(this, touches, event);
|
|
1023
1023
|
if (this._touch !== null){
|
|
1024
|
-
var location = touches[0].
|
|
1024
|
+
var location = touches[0].locationInWindow;
|
|
1025
1025
|
var diff = location.subtracting(this._touch.location0);
|
|
1026
1026
|
if ((diff.x * diff.x + diff.y * diff.y) > 2){
|
|
1027
1027
|
this._cancelTouchSelection();
|
|
@@ -39,6 +39,7 @@ JSClass("UIDisplayServer", JSObject, {
|
|
|
39
39
|
this.layerAnimationQueue = {};
|
|
40
40
|
this._scheduleQueue = [];
|
|
41
41
|
this._scheduled = [];
|
|
42
|
+
this._completedAnimations = [];
|
|
42
43
|
},
|
|
43
44
|
|
|
44
45
|
// -------------------------------------------------------------------------
|
|
@@ -100,7 +101,7 @@ JSClass("UIDisplayServer", JSObject, {
|
|
|
100
101
|
this._scheduled = this._scheduleQueue;
|
|
101
102
|
this._scheduleQueue = [];
|
|
102
103
|
this._isUpdating = true;
|
|
103
|
-
|
|
104
|
+
this._updateAnimations(t);
|
|
104
105
|
this._flushLayerLayoutQueue();
|
|
105
106
|
this._flushLayerDisplayQueue();
|
|
106
107
|
this._flushLayerRepositionQueue();
|
|
@@ -110,9 +111,7 @@ JSClass("UIDisplayServer", JSObject, {
|
|
|
110
111
|
this._isUpdating = false;
|
|
111
112
|
|
|
112
113
|
// Call any animation callbacks
|
|
113
|
-
|
|
114
|
-
completedAnimations[i].completionFunction(completedAnimations[i]);
|
|
115
|
-
}
|
|
114
|
+
this._flushCompletedAnimations();
|
|
116
115
|
|
|
117
116
|
// Call any window insert/remove callbacks
|
|
118
117
|
var window;
|
|
@@ -228,8 +227,22 @@ JSClass("UIDisplayServer", JSObject, {
|
|
|
228
227
|
if (this.layerDisplayQueue.remove(layer)){
|
|
229
228
|
layer._needsDisplay = true;
|
|
230
229
|
}
|
|
230
|
+
var key;
|
|
231
|
+
var animation;
|
|
232
|
+
var completedAnimationKeys;
|
|
233
|
+
var i, l;
|
|
231
234
|
this.layerRepositionQueue.remove(layer);
|
|
232
235
|
if (layer.objectID in this.layerAnimationQueue){
|
|
236
|
+
completedAnimationKeys = [];
|
|
237
|
+
for (key in layer.animationsByKey){
|
|
238
|
+
animation = layer.animationsByKey[key];
|
|
239
|
+
this.completeAnimation(animation);
|
|
240
|
+
completedAnimationKeys.push(key);
|
|
241
|
+
}
|
|
242
|
+
for (i = 0, l = completedAnimationKeys.length; i < l; ++i){
|
|
243
|
+
key = completedAnimationKeys[i];
|
|
244
|
+
layer.removeAnimationForKey(key);
|
|
245
|
+
}
|
|
233
246
|
delete this.layerAnimationQueue[layer.objectID];
|
|
234
247
|
--this._animationCount;
|
|
235
248
|
}
|
|
@@ -246,24 +259,53 @@ JSClass("UIDisplayServer", JSObject, {
|
|
|
246
259
|
this.setUpdateNeeded();
|
|
247
260
|
},
|
|
248
261
|
|
|
262
|
+
_completedAnimations: null,
|
|
263
|
+
|
|
264
|
+
completeAnimation: function(animation){
|
|
265
|
+
this._completedAnimations.push(animation);
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
_flushCompletedAnimations: function(){
|
|
269
|
+
var i, l;
|
|
270
|
+
var animation;
|
|
271
|
+
for (i = 0, l = this._completedAnimations.length; i < l; ++i){
|
|
272
|
+
animation = this._completedAnimations[i];
|
|
273
|
+
if (animation.completionFunction){
|
|
274
|
+
animation.completionFunction(animation);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
this._completedAnimations = [];
|
|
278
|
+
},
|
|
279
|
+
|
|
249
280
|
_updateAnimations: function(t){
|
|
250
281
|
t /= this._animationScale;
|
|
251
282
|
var animation;
|
|
252
|
-
var completedAnimations = [];
|
|
253
283
|
var id, key;
|
|
254
284
|
var layer;
|
|
285
|
+
var completedAnimationKeys;
|
|
286
|
+
var i, l;
|
|
287
|
+
var parts;
|
|
255
288
|
for (id in this.layerAnimationQueue){
|
|
256
289
|
layer = this.layerAnimationQueue[id];
|
|
290
|
+
completedAnimationKeys = [];
|
|
257
291
|
for (key in layer.animationsByKey){
|
|
258
292
|
animation = layer.animationsByKey[key];
|
|
259
293
|
animation.updateForTime(t);
|
|
260
294
|
if (this.reducedMotionEnabled || animation.isComplete){
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
295
|
+
completedAnimationKeys.push(key);
|
|
296
|
+
}else{
|
|
297
|
+
parts = key.split('.');
|
|
298
|
+
if (parts[0] in layer.presentation){
|
|
299
|
+
this.layerDidChangeProperty(layer, key);
|
|
264
300
|
}
|
|
265
301
|
}
|
|
266
|
-
|
|
302
|
+
}
|
|
303
|
+
for (i = 0, l = completedAnimationKeys.length; i < l; ++i){
|
|
304
|
+
key = completedAnimationKeys[i];
|
|
305
|
+
animation = layer.animationsByKey[key];
|
|
306
|
+
layer.removeAnimationForKey(key);
|
|
307
|
+
this.completeAnimation(animation);
|
|
308
|
+
parts = key.split('.');
|
|
267
309
|
if (parts[0] in layer.presentation){
|
|
268
310
|
this.layerDidChangeProperty(layer, key);
|
|
269
311
|
}
|
|
@@ -273,7 +315,6 @@ JSClass("UIDisplayServer", JSObject, {
|
|
|
273
315
|
--this._animationCount;
|
|
274
316
|
}
|
|
275
317
|
}
|
|
276
|
-
return completedAnimations;
|
|
277
318
|
},
|
|
278
319
|
|
|
279
320
|
// -------------------------------------------------------------------------
|
|
@@ -608,6 +608,9 @@ JSClass("UILayer", JSObject, {
|
|
|
608
608
|
},
|
|
609
609
|
|
|
610
610
|
removeAnimationForKey: function(key){
|
|
611
|
+
if (!(key in this.animationsByKey)){
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
611
614
|
--this.animationCount;
|
|
612
615
|
if (this.animationCount === 0){
|
|
613
616
|
// If we're all done with animations, reset our presentation to be identical to our model
|
|
@@ -355,6 +355,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
355
355
|
var y;
|
|
356
356
|
var diff;
|
|
357
357
|
var height;
|
|
358
|
+
var newHeight;
|
|
358
359
|
var item;
|
|
359
360
|
var y0 = firstVisibleItem.view.position.y - firstVisibleItem.view.anchorPoint.y * firstVisibleItem.view.bounds.size.height;
|
|
360
361
|
|
|
@@ -372,9 +373,10 @@ JSClass("UIListView", UIScrollView, {
|
|
|
372
373
|
cell = item.view;
|
|
373
374
|
height = cell.bounds.size.height;
|
|
374
375
|
y = cell.position.y - cell.anchorPoint.y * height;
|
|
376
|
+
newHeight = this._heightForCellAtIndexPath(indexPath);
|
|
375
377
|
this._enqueueReusableCell(cell);
|
|
376
|
-
cell = this._createCellAtIndexPath(indexPath, JSRect(0, y, cell.bounds.size.width,
|
|
377
|
-
diff =
|
|
378
|
+
cell = this._createCellAtIndexPath(indexPath, JSRect(0, y, cell.bounds.size.width, newHeight));
|
|
379
|
+
diff = newHeight - height;
|
|
378
380
|
if (cell !== item.view){
|
|
379
381
|
this._cellsContainerView.insertSubviewBelowSibling(cell, item.view);
|
|
380
382
|
item.view.removeFromSuperview();
|
|
@@ -382,6 +384,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
382
384
|
}
|
|
383
385
|
if (diff !== 0){
|
|
384
386
|
visibleSizeChanged = true;
|
|
387
|
+
contentSize.height += diff;
|
|
385
388
|
}
|
|
386
389
|
}
|
|
387
390
|
}
|
|
@@ -397,6 +400,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
397
400
|
}else{
|
|
398
401
|
this.contentSize = contentSize;
|
|
399
402
|
this.contentOffset = contentOffset;
|
|
403
|
+
this._layoutVisibleItems(this._visibleItems, y0);
|
|
400
404
|
}
|
|
401
405
|
|
|
402
406
|
},
|
|
@@ -489,7 +493,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
489
493
|
_approximateHeightForSection: function(section, stopRow){
|
|
490
494
|
var height = this._approximateYForSectionFooter(section);
|
|
491
495
|
if (this.delegate && this.delegate.heightForListViewFooterInSection && !this.delegate.estimatedHeightForListViewFooters){
|
|
492
|
-
height
|
|
496
|
+
height += this.delegate.heightForListViewFooterInSection(this, section);
|
|
493
497
|
}else{
|
|
494
498
|
height += this._approximateFooterHeight;
|
|
495
499
|
}
|
|
@@ -1635,7 +1639,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
1635
1639
|
_heightForFooterInSection: function(section){
|
|
1636
1640
|
var height = this._approximateFooterHeight;
|
|
1637
1641
|
if (this.delegate.heightForListViewFooterInSection){
|
|
1638
|
-
height = this.delegate.heightForListViewFooterInSection(section);
|
|
1642
|
+
height = this.delegate.heightForListViewFooterInSection(this, section);
|
|
1639
1643
|
}
|
|
1640
1644
|
return height;
|
|
1641
1645
|
},
|
|
@@ -2347,7 +2351,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2347
2351
|
return;
|
|
2348
2352
|
}
|
|
2349
2353
|
this._touch = {
|
|
2350
|
-
location0: touches[0].
|
|
2354
|
+
location0: touches[0].locationInWindow,
|
|
2351
2355
|
cell: null,
|
|
2352
2356
|
timer: JSTimer.scheduledTimerWithInterval(0.05, function(){
|
|
2353
2357
|
this._touch.timer = null;
|
|
@@ -2359,7 +2363,7 @@ JSClass("UIListView", UIScrollView, {
|
|
|
2359
2363
|
touchesMoved: function(touches, event){
|
|
2360
2364
|
UIListView.$super.touchesMoved.call(this, touches, event);
|
|
2361
2365
|
if (this._touch !== null){
|
|
2362
|
-
var location = touches[0].
|
|
2366
|
+
var location = touches[0].locationInWindow;
|
|
2363
2367
|
var diff = location.subtracting(this._touch.location0);
|
|
2364
2368
|
if ((diff.x * diff.x + diff.y * diff.y) > 2){
|
|
2365
2369
|
this._cancelTouchSelection();
|
|
@@ -309,20 +309,6 @@ JSClass("UIMenuWindow", UIWindow, {
|
|
|
309
309
|
this._adjustHighlightForLocation(this._lastMoveLocation);
|
|
310
310
|
},
|
|
311
311
|
|
|
312
|
-
mouseDragged: function(event){
|
|
313
|
-
if (this._isClosing){
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
var location = event.locationInView(this);
|
|
317
|
-
this._lastMoveLocation = event.locationInView(this);
|
|
318
|
-
this._adjustHighlightForLocation(this._lastMoveLocation);
|
|
319
|
-
if (!this.containsPoint(location)){
|
|
320
|
-
if (this._menu.supermenu !== null && this._menu.supermenu.stylerProperties.window){
|
|
321
|
-
this._menu.supermenu.stylerProperties.window.mouseDragged(event);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
|
|
326
312
|
mouseExited: function(event){
|
|
327
313
|
if (this._isClosing){
|
|
328
314
|
return;
|
|
@@ -350,6 +336,37 @@ JSClass("UIMenuWindow", UIWindow, {
|
|
|
350
336
|
|
|
351
337
|
_itemDownTimestamp: UIEvent.minimumTimestamp,
|
|
352
338
|
|
|
339
|
+
mouseDown: function(event){
|
|
340
|
+
if (this._isClosing){
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
var location = event.locationInView(this);
|
|
344
|
+
if (!this.containsPoint(location)){
|
|
345
|
+
if (this._menu.supermenu && this._menu.supermenu.stylerProperties.window){
|
|
346
|
+
this._menu.supermenu.stylerProperties.window.mouseDown(event);
|
|
347
|
+
}else{
|
|
348
|
+
this.closeAll(true);
|
|
349
|
+
}
|
|
350
|
+
}else{
|
|
351
|
+
this._lastMoveLocation = event.locationInView(this);
|
|
352
|
+
this._adjustHighlightForLocation(this._lastMoveLocation);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
mouseDragged: function(event){
|
|
357
|
+
if (this._isClosing){
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
var location = event.locationInView(this);
|
|
361
|
+
this._lastMoveLocation = event.locationInView(this);
|
|
362
|
+
this._adjustHighlightForLocation(this._lastMoveLocation);
|
|
363
|
+
if (!this.containsPoint(location)){
|
|
364
|
+
if (this._menu.supermenu !== null && this._menu.supermenu.stylerProperties.window){
|
|
365
|
+
this._menu.supermenu.stylerProperties.window.mouseDragged(event);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
|
|
353
370
|
mouseUp: function(event){
|
|
354
371
|
if (event.timestamp - this._itemDownTimestamp < 0.2){
|
|
355
372
|
return;
|
|
@@ -369,23 +386,65 @@ JSClass("UIMenuWindow", UIWindow, {
|
|
|
369
386
|
}
|
|
370
387
|
},
|
|
371
388
|
|
|
372
|
-
|
|
389
|
+
// -----------------------------------------------------------------------
|
|
390
|
+
// MARK: - Touch Events
|
|
391
|
+
|
|
392
|
+
touchesBegan: function(touches, event){
|
|
373
393
|
if (this._isClosing){
|
|
374
394
|
return;
|
|
375
395
|
}
|
|
376
|
-
|
|
396
|
+
if (touches.length > 1){
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
var location = touches[0].locationInView(this);
|
|
377
400
|
if (!this.containsPoint(location)){
|
|
378
401
|
if (this._menu.supermenu && this._menu.supermenu.stylerProperties.window){
|
|
379
|
-
this._menu.supermenu.stylerProperties.window.
|
|
402
|
+
this._menu.supermenu.stylerProperties.window.touchesBegan(touches, event);
|
|
380
403
|
}else{
|
|
381
404
|
this.closeAll(true);
|
|
382
405
|
}
|
|
383
406
|
}else{
|
|
384
|
-
this._lastMoveLocation =
|
|
407
|
+
this._lastMoveLocation = location;
|
|
385
408
|
this._adjustHighlightForLocation(this._lastMoveLocation);
|
|
386
409
|
}
|
|
387
410
|
},
|
|
388
411
|
|
|
412
|
+
touchesMoved: function(touches, event){
|
|
413
|
+
if (this._isClosing){
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
var location = touches[0].locationInView(this);
|
|
417
|
+
this._lastMoveLocation = location;
|
|
418
|
+
this._adjustHighlightForLocation(this._lastMoveLocation);
|
|
419
|
+
if (!this.containsPoint(location)){
|
|
420
|
+
if (this._menu.supermenu !== null && this._menu.supermenu.stylerProperties.window){
|
|
421
|
+
this._menu.supermenu.stylerProperties.window.touchesMoved(touches, event);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
touchesEnded: function(touches, event){
|
|
427
|
+
if (event.timestamp - this._itemDownTimestamp < 0.2){
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (this._isClosing){
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
var location = touches[0].locationInView(this);
|
|
434
|
+
if (this.containsPoint(location)){
|
|
435
|
+
this._performActionForHighlightedItem();
|
|
436
|
+
}else{
|
|
437
|
+
if (this._menu.supermenu && this._menu.supermenu.stylerProperties.window){
|
|
438
|
+
this._menu.supermenu.stylerProperties.window.touchesEnded(touches, event);
|
|
439
|
+
}else{
|
|
440
|
+
this.closeAll(true);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
|
|
445
|
+
touchesCanceled: function(touches, event){
|
|
446
|
+
},
|
|
447
|
+
|
|
389
448
|
// -----------------------------------------------------------------------
|
|
390
449
|
// MARK: - Key Events
|
|
391
450
|
|
|
@@ -428,6 +428,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
428
428
|
navigationBar.maskedBorders = UIView.Sides.maxY;
|
|
429
429
|
|
|
430
430
|
var props = navigationBar.stylerProperties;
|
|
431
|
+
props.isAnimating = false;
|
|
432
|
+
props.needsUpdate = false;
|
|
431
433
|
props.titleLabel = this.createTitleLabel();
|
|
432
434
|
props.customView = null;
|
|
433
435
|
navigationBar.addSubview(props.titleLabel);
|
|
@@ -468,6 +470,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
468
470
|
var removingRightBarItemViews = props.rightBarItemViews;
|
|
469
471
|
var removingTitleLabel = props.titleLabel;
|
|
470
472
|
var removingCustomView = props.customView;
|
|
473
|
+
var removingCustomViewTransform = removingCustomView ? removingCustomView.transform : JSAffineTransform.Identity;
|
|
474
|
+
var customViewTransform = JSAffineTransform.Identity;
|
|
471
475
|
var backToTitleScale = this.titleFont.displayLineHeight / this.itemFont.displayLineHeight;
|
|
472
476
|
props.titleLabel = this.createTitleLabel();
|
|
473
477
|
navigationBar.addSubview(props.titleLabel);
|
|
@@ -488,15 +492,16 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
488
492
|
props.titleLabel.alpha = 0;
|
|
489
493
|
props.titleLabel.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width, 0);
|
|
490
494
|
if (props.customView){
|
|
495
|
+
customViewTransform = props.customView.transform;
|
|
491
496
|
props.customView.alpha = 0;
|
|
492
|
-
props.customView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width,
|
|
497
|
+
props.customView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width + customViewTransform.tx, customViewTransform.ty);
|
|
493
498
|
}
|
|
494
499
|
props.backBarItemView.alpha = 0;
|
|
495
500
|
var backTitleFrame = props.backBarItemView.titleLabel.convertRectToView(props.backBarItemView.titleLabel.bounds, props.backBarItemView.superview);
|
|
496
501
|
if (removingCustomView){
|
|
497
|
-
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingCustomView.
|
|
502
|
+
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingCustomView.untransformedFrame.origin.x - backTitleFrame.origin.x), 0).scaledBy(backToTitleScale);
|
|
498
503
|
}else{
|
|
499
|
-
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingTitleLabel.
|
|
504
|
+
props.backBarItemView.titleLabel.transform = JSAffineTransform.Translated(Math.max(0, removingTitleLabel.untransformedFrame.origin.x - backTitleFrame.origin.x), 0).scaledBy(backToTitleScale);
|
|
500
505
|
}
|
|
501
506
|
animator.addAnimations(function(){
|
|
502
507
|
var i, l;
|
|
@@ -514,20 +519,20 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
514
519
|
}
|
|
515
520
|
removingBackBarItemView.alpha = 0;
|
|
516
521
|
removingTitleLabel.alpha = 0;
|
|
517
|
-
removingTitleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingTitleLabel.
|
|
522
|
+
removingTitleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingTitleLabel.untransformedFrame.origin.x), 0).scaledBy(1 / backToTitleScale);
|
|
518
523
|
if (removingCustomView){
|
|
519
524
|
removingCustomView.alpha = 0;
|
|
520
|
-
removingCustomView.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingCustomView.
|
|
525
|
+
removingCustomView.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - removingCustomView.untransformedFrame.origin.x) + removingCustomViewTransform.tx, removingCustomViewTransform.ty).scaledBy(1 / backToTitleScale);
|
|
521
526
|
}
|
|
522
527
|
props.titleLabel.alpha = 1;
|
|
523
528
|
props.titleLabel.transform = JSAffineTransform.Identity;
|
|
524
529
|
if (props.customView){
|
|
525
530
|
props.customView.alpha = 1;
|
|
526
|
-
props.customView.transform =
|
|
531
|
+
props.customView.transform = customViewTransform;
|
|
527
532
|
}
|
|
528
533
|
props.backBarItemView.alpha = 1;
|
|
529
534
|
props.backBarItemView.titleLabel.transform = JSAffineTransform.Identity;
|
|
530
|
-
});
|
|
535
|
+
}, this);
|
|
531
536
|
animator.addCompletion(function(){
|
|
532
537
|
var i, l;
|
|
533
538
|
for (i = 0, l = removingLeftBarItemViews.length; i < l; ++i){
|
|
@@ -540,9 +545,14 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
540
545
|
removingBackBarItemView.removeFromSuperview();
|
|
541
546
|
if (removingCustomView !== null){
|
|
542
547
|
removingCustomView.removeFromSuperview();
|
|
543
|
-
removingCustomView.transform =
|
|
548
|
+
removingCustomView.transform = removingCustomViewTransform;
|
|
544
549
|
}
|
|
545
|
-
|
|
550
|
+
props.isAnimating = false;
|
|
551
|
+
if (props.needsUpdate){
|
|
552
|
+
this.updateBar(navigationBar);
|
|
553
|
+
}
|
|
554
|
+
}, this);
|
|
555
|
+
props.isAnimating = true;
|
|
546
556
|
},
|
|
547
557
|
|
|
548
558
|
popToItem: function(navigationBar, item, animator){
|
|
@@ -553,6 +563,8 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
553
563
|
var removingRightBarItemViews = props.rightBarItemViews;
|
|
554
564
|
var removingTitleLabel = props.titleLabel;
|
|
555
565
|
var removingCustomView = props.customView;
|
|
566
|
+
var removingCustomViewTransform = removingCustomView ? removingCustomView.transform : JSAffineTransform.Identity;
|
|
567
|
+
var customViewTransform = JSAffineTransform.Identity;
|
|
556
568
|
var backToTitleScale = this.titleFont.displayLineHeight / this.itemFont.displayLineHeight;
|
|
557
569
|
props.titleLabel = this.createTitleLabel();
|
|
558
570
|
navigationBar.addSubview(props.titleLabel);
|
|
@@ -574,10 +586,11 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
574
586
|
props.backBarItemView.alpha = 0;
|
|
575
587
|
var backTitleFrame = removingBackBarItemView.titleLabel.convertRectToView(removingBackBarItemView.titleLabel.bounds, props.backBarItemView.superview);
|
|
576
588
|
if (props.customView){
|
|
577
|
-
|
|
589
|
+
customViewTransform = props.customView.transform;
|
|
590
|
+
props.customView.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - props.customView.untransformedFrame.origin.x) + customViewTransform.tx, customViewTransform.ty).scaledBy(1 / backToTitleScale);
|
|
578
591
|
props.customView.alpha = 0;
|
|
579
592
|
}else{
|
|
580
|
-
props.titleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - props.titleLabel.
|
|
593
|
+
props.titleLabel.transform = JSAffineTransform.Translated(Math.min(0, backTitleFrame.origin.x - props.titleLabel.untransformedFrame.origin.x), 0).scaledBy(1 / backToTitleScale);
|
|
581
594
|
}
|
|
582
595
|
animator.addAnimations(function(){
|
|
583
596
|
var i, l;
|
|
@@ -598,7 +611,7 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
598
611
|
removingTitleLabel.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width, 0);
|
|
599
612
|
if (removingCustomView){
|
|
600
613
|
removingCustomView.alpha = 0;
|
|
601
|
-
removingCustomView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width,
|
|
614
|
+
removingCustomView.transform = JSAffineTransform.Translated(navigationBar.bounds.size.width + removingCustomViewTransform.tx, removingCustomViewTransform.ty);
|
|
602
615
|
}
|
|
603
616
|
props.titleLabel.alpha = 1;
|
|
604
617
|
props.titleLabel.transform = JSAffineTransform.Identity;
|
|
@@ -606,9 +619,9 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
606
619
|
props.backBarItemView.titleLabel.transform = JSAffineTransform.Identity;
|
|
607
620
|
if (props.customView){
|
|
608
621
|
props.customView.alpha = 1;
|
|
609
|
-
props.customView.transform =
|
|
622
|
+
props.customView.transform = customViewTransform;
|
|
610
623
|
}
|
|
611
|
-
});
|
|
624
|
+
}, this);
|
|
612
625
|
animator.addCompletion(function(){
|
|
613
626
|
var i, l;
|
|
614
627
|
for (i = 0, l = removingLeftBarItemViews.length; i < l; ++i){
|
|
@@ -621,14 +634,24 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
621
634
|
removingBackBarItemView.removeFromSuperview();
|
|
622
635
|
if (removingCustomView !== null){
|
|
623
636
|
removingCustomView.removeFromSuperview();
|
|
624
|
-
removingCustomView.transform =
|
|
637
|
+
removingCustomView.transform = removingCustomViewTransform;
|
|
638
|
+
}
|
|
639
|
+
props.isAnimating = false;
|
|
640
|
+
if (props.needsUpdate){
|
|
641
|
+
this.updateBar(navigationBar);
|
|
625
642
|
}
|
|
626
|
-
});
|
|
643
|
+
}, this);
|
|
644
|
+
props.isAnimating = true;
|
|
627
645
|
},
|
|
628
646
|
|
|
629
647
|
updateBar: function(navigationBar){
|
|
630
648
|
var item = navigationBar.topItem;
|
|
631
649
|
var props = navigationBar.stylerProperties;
|
|
650
|
+
if (props.isAnimating){
|
|
651
|
+
props.needsUpdate = true;
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
props.needsUpdate = false;
|
|
632
655
|
|
|
633
656
|
var i, l;
|
|
634
657
|
for (i = 0, l = props.leftBarItemViews.length; i < l; ++i){
|
|
@@ -708,7 +731,7 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
708
731
|
var barItemView = props.backBarItemView;
|
|
709
732
|
var titleTextAlignment = item ? item.titleTextAlignment || this.titleTextAlignment : this.titleTextAlignment;
|
|
710
733
|
barItemView.sizeToFitSize(JSSize(xRight - xLeft, itemHeight));
|
|
711
|
-
barItemView.
|
|
734
|
+
barItemView.untransformedFrame = JSRect(JSPoint(xLeft, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
|
|
712
735
|
if (!barItemView.hidden){
|
|
713
736
|
xLeft += barItemView.bounds.size.width;
|
|
714
737
|
}else if (props.leftBarItemViews.length === 0 && titleTextAlignment === JSTextAlignment.left && this.titleInsets !== null){
|
|
@@ -717,14 +740,14 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
717
740
|
for (i = 0, l = props.leftBarItemViews.length; i < l; ++i){
|
|
718
741
|
barItemView = props.leftBarItemViews[i];
|
|
719
742
|
barItemView.sizeToFitSize(JSSize(xRight - xLeft, itemHeight));
|
|
720
|
-
barItemView.
|
|
743
|
+
barItemView.untransformedFrame = JSRect(JSPoint(xLeft, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
|
|
721
744
|
xLeft += barItemView.bounds.size.width;
|
|
722
745
|
}
|
|
723
746
|
for (i = props.rightBarItemViews.length - 1; i >= 0; --i){
|
|
724
747
|
barItemView = props.rightBarItemViews[i];
|
|
725
748
|
barItemView.sizeToFitSize(JSSize(xRight - xLeft, itemHeight));
|
|
726
749
|
xRight -= barItemView.bounds.size.width;
|
|
727
|
-
barItemView.
|
|
750
|
+
barItemView.untransformedFrame = JSRect(JSPoint(xRight, y + (itemHeight - barItemView.bounds.size.height) / 2), barItemView.bounds.size);
|
|
728
751
|
barItemView.hidden = xRight < xLeft;
|
|
729
752
|
}
|
|
730
753
|
|
|
@@ -746,11 +769,11 @@ JSClass("UINavigationBarDefaultStyler", UINavigationBarStyler, {
|
|
|
746
769
|
var centeredX = (size.width - viewSize.width) / 2;
|
|
747
770
|
var centeredY = (size.height - viewSize.height) / 2;
|
|
748
771
|
if (titleTextAlignment === JSTextAlignment.center){
|
|
749
|
-
titleView.
|
|
772
|
+
titleView.untransformedFrame = JSRect(JSPoint(Math.min(Math.max(minX, centeredX), maxX), centeredY), viewSize);
|
|
750
773
|
}else if (titleTextAlignment === JSTextAlignment.right){
|
|
751
|
-
titleView.
|
|
774
|
+
titleView.untransformedFrame = JSRect(JSPoint(maxX - viewSize.width, centeredY), viewSize);
|
|
752
775
|
}else{
|
|
753
|
-
titleView.
|
|
776
|
+
titleView.untransformedFrame = JSRect(JSPoint(minX, centeredY), viewSize);
|
|
754
777
|
}
|
|
755
778
|
}else{
|
|
756
779
|
props.titleLabel.hidden = true;
|