Skip to content

Instantly share code, notes, and snippets.

@ShawInnes
Created July 2, 2014 13:41
Show Gist options
  • Save ShawInnes/7d6c369772e73b4cd0ab to your computer and use it in GitHub Desktop.
Save ShawInnes/7d6c369772e73b4cd0ab to your computer and use it in GitHub Desktop.
class NullShadowBuilder : View.DragShadowBuilder
{
const int centerOffset = 52;
int width, height;
public NullShadowBuilder (View baseView) : base (baseView)
{
}
public override void OnProvideShadowMetrics (Point shadowSize, Point shadowTouchPoint)
{
width = 75;
height = 75;
// This is the overall dimension of your drag shadow
shadowSize.Set (width * 2, height * 2);
// This one tells the system how to translate your shadow on the screen so
// that the user fingertip is situated on that point of your canvas.
// In my case, the touch point is in the middle of the (height, width) top-right rect
shadowTouchPoint.Set (width + width / 2 - centerOffset, height / 2 + centerOffset);
}
public override void OnDrawShadow (Canvas canvas)
{
base.OnDrawShadow (canvas);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment