@@ -1233,52 +1233,68 @@ open class TableView: ScrollView, NSTableViewDelegate,NSTableViewDataSource,Sele
1233
1233
1234
1234
let s = self . frame. size
1235
1235
1236
- if animated {
1236
+ if animated && !tableView . isFlipped {
1237
1237
1238
1238
1239
1239
//if !tableView.isFlipped {
1240
1240
1241
- let y = ( s. height - size. height)
1242
-
1243
- CATransaction . begin ( )
1244
-
1245
- // if y < 0 {
1246
-
1247
- var presentBounds : NSRect = self . layer? . bounds ?? self . bounds
1248
- var presentation = self . layer? . presentation ( )
1249
- if let presentation = presentation, self . layer? . animation ( forKey: " bounds " ) != nil {
1241
+
1242
+
1243
+ CATransaction . begin ( )
1244
+
1245
+ // if y < 0 {
1246
+
1247
+ var presentBounds : NSRect = self . layer? . bounds ?? self . bounds
1248
+ var presentation = self . layer? . presentation ( )
1249
+ if let presentation = presentation, self . layer? . animation ( forKey: " bounds " ) != nil {
1250
+ presentBounds = presentation. bounds
1251
+ }
1252
+
1253
+ self . layer? . animateBounds ( from: presentBounds, to: NSMakeRect ( 0 , self . bounds. minY, size. width, size. height) , duration: 0.2 , timingFunction: kCAMediaTimingFunctionEaseOut)
1254
+
1255
+
1256
+ var y = ( size. height - presentBounds. height)
1257
+
1258
+ // if (y > 0) {
1259
+ presentBounds = contentView. layer? . bounds ?? contentView. bounds
1260
+ if let presentation = contentView. layer? . presentation ( ) , contentView. layer? . animation ( forKey: " bounds " ) != nil {
1250
1261
presentBounds = presentation. bounds
1251
1262
}
1252
1263
1253
- self . layer? . animateBounds ( from: presentBounds, to: NSMakeRect ( 0 , self . bounds. minY, size. width, size. height) , duration: 0.2 , timingFunction: kCAMediaTimingFunctionEaseOut)
1254
-
1255
-
1256
-
1257
- if ( y > 0 ) {
1258
- var presentBounds : NSRect = contentView. layer? . bounds ?? contentView. bounds
1259
- presentation = contentView. layer? . presentation ( )
1260
- if let presentation = presentation, contentView. layer? . animation ( forKey: " bounds " ) != nil {
1261
- presentBounds = presentation. bounds
1262
- }
1264
+ if y > 0 {
1265
+ presentBounds. origin. y -= y
1263
1266
presentBounds. size. height += y
1264
- contentView. layer? . animateBounds ( from: presentBounds, to: NSMakeRect ( 0 , contentView. bounds. minY, size. width, size. height) , duration: 0.2 , timingFunction: kCAMediaTimingFunctionEaseOut)
1265
-
1267
+ } else {
1268
+ presentBounds. origin. y += y
1269
+ presentBounds. size. height -= y
1266
1270
}
1267
- // }
1268
- if !tableView. isFlipped {
1269
- var currentY : CGFloat = 0
1270
1271
1271
- presentation = contentView. layer? . presentation ( )
1272
- if let presentation = presentation, contentView. layer? . animation ( forKey: " position " ) != nil {
1273
- currentY = presentation. position. y
1274
- }
1272
+ contentView. layer? . animateBounds ( from: presentBounds, to: NSMakeRect ( 0 , contentView. bounds. minY, size. width, size. height) , duration: 0.2 , timingFunction: kCAMediaTimingFunctionEaseOut)
1275
1273
1276
- let pos = contentView. layer? . position ?? NSZeroPoint
1277
- contentView. layer? . animatePosition ( from: NSMakePoint ( 0 , currentY + ( y > 0 ? - y : y) ) , to: pos, duration: 0.2 , timingFunction: kCAMediaTimingFunctionEaseOut)
1278
- }
1274
+ // }
1275
+ // else if !tableView.isFlipped {
1276
+ // var currentY:CGFloat = 0
1277
+ //
1278
+ // presentation = contentView.layer?.presentation()
1279
+ // if let presentation = presentation, contentView.layer?.animation(forKey:"position") != nil {
1280
+ // currentY = presentation.position.y
1281
+ // }
1282
+ //
1283
+ // //let realY = abs(size.height - )
1284
+ //
1285
+ // let pos = contentView.layer?.position ?? NSZeroPoint
1286
+ //
1287
+ // NSLog("\(currentY) y: \(y)")
1288
+ // // if currentY == 0 {
1289
+ // // currentY
1290
+ // // } else {
1291
+ // //
1292
+ // // }
1293
+ // contentView.layer?.animatePosition(from: NSMakePoint(0, -y), to: pos, duration: 0.2, timingFunction: kCAMediaTimingFunctionEaseOut)
1294
+ // }
1279
1295
1280
1296
1281
- CATransaction . commit ( )
1297
+ CATransaction . commit ( )
1282
1298
1283
1299
// }
1284
1300
}
0 commit comments