/// <summary> /// A slot for receiving the stage resize signal /// </summary> /// <param name="parameters"></param> public void MouseDownSlot(params object[] parameters) { //Debug.Log("PopupManagerMouseDownSlot: receive"); if (Popups.Count == 0) { return; } var lastPopup = Popups[Popups.Count - 1]; //Debug.Log("Popups.Count: " + Popups.Count); Point p = (Point)parameters[1]; //var container = lastPopup as Container; var container = lastPopup as Group; bool found = false; if (null != container) // I am a Container { //if (container.QClipContent/* || container.QScrollContent*/) // clipped, go for optimized version //{ // if (!lastPopup.Transform.GlobalBounds.Contains(p)) // check global bounds only // { // found = true; // } //} //else // non-clipped //{ if (!lastPopup.ContainsPoint(p, true)) // check children recursivelly { found = true; } //} } else // I am a DisplayObjectContainer { if (!lastPopup.ContainsPoint(p, true)) // go for recursion, no optimization for a DisplayObjectContainer { found = true; } } //Debug.Log("found: " + found); if (found) { MouseDownOutsideHandler(lastPopup, p); } }
/// <summary> /// A slot for receiving the stage resize signal /// When a resize received, we go through each single popup and do a removal or centering /// </summary> /// <param name="parameters"></param> public void ResizeSlot(params object[] parameters) { Point p = (Point)parameters[0]; Rectangle r = Rectangle.FromSize(p); var descriptors = Descriptors; foreach (Component popup in Descriptors.Keys) { // get descriptor var descriptor = descriptors[popup]; // test for remove on screen resize if (descriptor.RemoveOnScreenResize) { RemovePopup(popup); return; } if (null != descriptor.Overlay) { //descriptor.Overlay.Bounds = r; //Stage.Bounds; descriptor.Overlay.X = r.X; descriptor.Overlay.Y = r.Y; descriptor.Overlay.Width = r.Width; descriptor.Overlay.Height = r.Height; } // resizing overlay //if (null != descriptor.Overlay) //{ // var bounds = (null != descriptor.Owner) ? descriptor.Owner.Bounds : PopupManager.Stage.Bounds; // //Debug.Log("Bounding overlay: " + bounds); // //descriptor.Overlay.SetBounds(popup.Owner.Bounds); // descriptor.Overlay.Bounds = (Rectangle) bounds.Clone(); //} // center popup? if (descriptor.KeepCenter) { CenterPopUp(popup, true); } } }
/// <summary> /// A slot for receiving the mouse wheel signal /// </summary> /// <param name="parameters"></param> public void MouseWheelSlot(params object[] parameters) { if (Popups.Count == 0) { return; } var lastPopup = Popups[Popups.Count - 1]; Point p = (Point)parameters[1]; var container = lastPopup as Group; if (null != container) // I am a Container { //if (container.QClipContent/* || container.QScrollContent*/) // clipped, go for optimized version //{ // if (!lastPopup.Transform.GlobalBounds.Contains(p)) // check global bounds only // { // MouseWheelOutsideHandler(lastPopup, p); // } //} //else // non-clipped //{ if (!lastPopup.ContainsPoint(p, true)) // check children recursivelly { MouseWheelOutsideHandler(lastPopup, p); } //} } else // I am a DisplayObjectContainer { if (!lastPopup.ContainsPoint(p, true)) // go for recursion, no optimization for a DisplayObjectContainer { MouseWheelOutsideHandler(lastPopup, p); } } }
internal void MouseWheelOutsideHandler(DisplayObject popup, Point point) { #if DEBUG if (DebugMode) { Debug.Log("MouseDownOutsideHandler: " + popup); } #endif // dispatch from here MouseEvent e = new MouseEvent(MouseEvent.MOUSE_WHEEL_OUTSIDE) { GlobalPosition = point, Target = popup }; DispatchEvent(e); if (e.Canceled) { return; } // dispatch from popup e = new MouseEvent(MouseEvent.MOUSE_WHEEL_OUTSIDE) { GlobalPosition = point }; popup.DispatchEvent(e); if (e.Canceled) { return; } // check auto remove if (_descriptors.ContainsKey(popup) && _descriptors[popup].RemoveOnMouseWheelOutside) { RemovePopup(popup); return; } }
internal void MouseWheelOutsideHandler(DisplayObject popup, Point point) { #if DEBUG if (DebugMode) { Debug.Log("MouseDownOutsideHandler: " + popup); } #endif // dispatch from here MouseEvent e = new MouseEvent(MouseEvent.MOUSE_WHEEL_OUTSIDE) { GlobalPosition = point, Target = popup }; DispatchEvent(e); if (e.Canceled) return; // dispatch from popup e = new MouseEvent(MouseEvent.MOUSE_WHEEL_OUTSIDE) { GlobalPosition = point }; popup.DispatchEvent(e); if (e.Canceled) return; // check auto remove if (_descriptors.ContainsKey(popup) && _descriptors[popup].RemoveOnMouseWheelOutside) { RemovePopup(popup); return; } }