Example #1
0
		CanvasElement GetInputElementAt (Cairo.Context context, CanvasElement root, double x, double y)
		{
			if (root.InputTransparent)
				return null;

			var children = root.Children;

			if (children != null) {
				// Manual loop to avoid excessive creation of iterators
				for (int i = children.Count - 1; i >= 0; i--) {
					var result = GetInputElementAt (context, children[i], x, y);
					if (result != null)
						return result;
				}
			}

			context.Save ();
			root.LayoutOutline (context);
			var point = TransformPoint (root, x, y);
			
			if (context.InFill (point.X, point.Y)) {
				context.NewPath ();
				context.Restore ();
				return root;
			}
			context.NewPath ();
			context.Restore ();
			return null;
		}