@@ -7,7 +7,7 @@ use objc2_core_foundation::{CFRetained, CGPoint, CGRect, CGSize};
77use objc2_core_graphics:: { CGColor , CGMutablePath , CGPath } ;
88use objc2_foundation:: { NSArray , NSNumber , ns_string} ;
99use objc2_quartz_core:: {
10- CAAnimation , CAAnimationGroup , CABasicAnimation , CAGradientLayer , CALayer , CAMediaTiming ,
10+ CAAnimation , CAAnimationGroup , CABasicAnimation , CAGradientLayer , CAMediaTiming ,
1111 CAMediaTimingFunction , CAShapeLayer , CATransaction , kCAMediaTimingFunctionEaseOut,
1212} ;
1313
@@ -253,32 +253,18 @@ impl UIDrawer {
253253impl HintBox {
254254 /// Fades the hint box out, then hides it.
255255 pub fn fade_out ( & self ) {
256- let layers: Vec < Retained < CALayer > > = std:: iter:: once ( self . box_layer . clone ( ) )
257- . chain ( self . frame_layer . iter ( ) . cloned ( ) )
258- . collect ( ) ;
259-
260- for layer in layers {
256+ for layer in std:: iter:: once ( & self . box_layer ) . chain ( self . frame_layer . iter ( ) ) {
261257 // Set the model opacity to 0 before the animation so the layer
262258 // stays hidden after the animation is removed.
263259 layer. setOpacity ( 0.0 ) ;
264260
265261 CATransaction :: begin ( ) ;
266-
267- let layer_clone = layer. clone ( ) ;
268- let completion = RcBlock :: new ( move || {
269- layer_clone. setHidden ( true ) ;
270- // Restore opacity so the layer can be shown again later.
271- layer_clone. setOpacity ( 1.0 ) ;
272- } ) ;
273262 unsafe {
274- CATransaction :: setCompletionBlock ( Some ( & completion) ) ;
275-
276263 let anim = CABasicAnimation :: animationWithKeyPath ( Some ( ns_string ! ( "opacity" ) ) ) ;
277264 anim. setFromValue ( Some ( & NSNumber :: new_f64 ( 1.0 ) ) ) ;
278265 anim. setToValue ( Some ( & NSNumber :: new_f64 ( 0.0 ) ) ) ;
279266 anim. setDuration ( HINT_FADE_OUT_DURATION ) ;
280267 anim. setRemovedOnCompletion ( true ) ;
281-
282268 layer. addAnimation_forKey ( & anim, Some ( ns_string ! ( "fade_out" ) ) ) ;
283269 }
284270 CATransaction :: commit ( ) ;
0 commit comments