Skip to content

Instantly share code, notes, and snippets.

@alanmcgovern
Created December 18, 2015 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanmcgovern/2f8efc914e256f4e18b5 to your computer and use it in GitHub Desktop.
Save alanmcgovern/2f8efc914e256f4e18b5 to your computer and use it in GitHub Desktop.
async Task DragConnectionLineAsync (DesignerItem item, Point location)
{
if (!Renderer.CaptureMouse ())
return;
IPhoneDesignerItem source;
var scene = item as SceneDesignerItem;
if (scene != null)
source = scene.ViewController;
else
source = (IPhoneDesignerItem) item;
var createConnection = new SceneConnectionCreateLine (source, location);
surfaceDragOperation = new AsyncDragOperation ();
try {
AddVisualItem (createConnection);
GetVisualItemCapture (createConnection);
await surfaceDragOperation.MouseReleased ();
} finally {
ReleaseVisualItemCapture ();
RemoveVisualItem (createConnection);
surfaceDragOperation = null;
}
ShowCreateConnectionMenu (createConnection.PossibleConnections);
// the menu seems to eat the key up event
currentModifier = ModifierKeys.None;
}
async Task DragSelectionRectAsync (DesignerItem item, Point location)
{
if (!Renderer.CaptureMouse ())
return;
var selectionRect = new MultipleSelectionRectangle (item, location);
surfaceDragOperation = new AsyncDragOperation ();
try {
AddVisualItem (selectionRect);
await surfaceDragOperation.MouseReleased ();
} finally {
RemoveVisualItem (selectionRect);
surfaceDragOperation = null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment