/// <summary> /// Shows the mask /// </summary> /// <param name="component"></param> public void Mask(DisplayListMember component) { _component = component; #if DEBUG if (DebugMode) { Debug.Log("Masking component: " + component); } #endif if (null != _maskGraphics) { return; // already masking this component } _parent = _component.Parent ?? (_component is Stage ? _component as Stage : null); if (null == _parent) { return; // we are not on the display list, so we have nothing to mask indeed } var imc = _component as InvalidationManagerClient; _maskGraphics = new T { IncludeInLayout = false, X = _component.X, Y = _component.Y, Width = null != imc?imc.GetExplicitOrMeasuredWidth() : _component.Width, Height = null != imc?imc.GetExplicitOrMeasuredHeight() : _component.Height //Bounds = (Rectangle)_component.Bounds.Clone() // NOTE: BEWARE! This was the reference bug (without Clone())!!!!!!!!! }; _parent.AddChild(_maskGraphics); //_maskGraphics.ValidateNow(); // commented out 20130331 and moved to LoadingMaskAnimator // critical! //_maskGraphics.Transform.Apply(); // TODO: remove //_maskGraphics.Parent.Transform.ValidateChild(_maskGraphics); _maskGraphics.InvalidateTransform(); // subscribe to MOVE and RESIZE events of the component // we shall be levitating just over the component _component.AddEventListener(MoveEvent.MOVE, MoveHandler, EventPhase.Target); _component.AddEventListener(ResizeEvent.RESIZE, ResizeHandler, EventPhase.Target); _maskGraphics.Play(); }
private void InstallViewport() { //Debug.Log("InstallViewport: " + this); if (null != Skin && null != Viewport) { Viewport.ClipAndEnableScrolling = true; DisplayListMember dlm = (DisplayListMember)Viewport; ((Group)Skin).AddContentChildAt(dlm, 0); dlm.AddEventListener(PropertyChangeEvent.PROPERTY_CHANGE, ViewportPropertyChangeHandler); InteractiveComponent ic = (InteractiveComponent)Viewport; ic.MouseEnabled = true; // because of mouse-wheeling! } if (null != VerticalScrollBar) { VerticalScrollBar.Viewport = Viewport; } if (null != HorizontalScrollBar) { HorizontalScrollBar.Viewport = Viewport; } }