Add new Sample Scenario - InkStroke - Resize and Move selected InkStroke#1189
Open
hjharvey-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Open
Add new Sample Scenario - InkStroke - Resize and Move selected InkStroke#1189hjharvey-MSFT wants to merge 2 commits intomicrosoft:mainfrom
hjharvey-MSFT wants to merge 2 commits intomicrosoft:mainfrom
Conversation
…oke that has been selected using lasso tool
added comments, removed redundant code, changed order of methods. etc.
ChrisGuzak
reviewed
Jun 19, 2020
| Windows::Foundation::EventRegistrationToken pointerExitedRectangleToken; | ||
| Windows::Foundation::EventRegistrationToken pointerMovedRectangleToken; | ||
| Windows::Foundation::EventRegistrationToken pointerPressedRectangleToken; | ||
|
|
ChrisGuzak
reviewed
Jun 19, 2020
| Scenario13::Scenario13() | ||
| { | ||
| InitializeComponent(); | ||
| LassoSelect = (Symbol)0xEF20; |
| if (currentManipulationType != ManipulationTypes::None) | ||
| return; | ||
|
|
||
| Windows::UI::Core::CoreWindow^ window = Windows::UI::Core::CoreWindow::GetForCurrentThread(); |
| /// <param name="e"></param> | ||
| void Scenario13::SelectionRectangle_ManipulationDelta(Object^ sender, Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs^ e) | ||
| { | ||
| CompositeTransform^ transform = (CompositeTransform^)selectionRectangle->RenderTransform; |
Member
There was a problem hiding this comment.
auto transform = ..., use safe_cast
| break; | ||
|
|
||
| case ManipulationTypes::Size: | ||
| //Example Scaling factor used to determine the speed at which the box will grow/shrink. |
Member
There was a problem hiding this comment.
space after //, here and below
| //Example Scaling factor used to determine the speed at which the box will grow/shrink. | ||
| auto scale = std::abs(1 + (float)e->Delta.Translation.X / 100); | ||
|
|
||
| //Restrict scaling to a Minimum value. this well prevent negative With amounts and app crashing. |
Member
There was a problem hiding this comment.
comment needs editing, This will prevent...
|
|
||
| auto allStrokes = inkCanvas->InkPresenter->StrokeContainer->GetStrokes(); | ||
|
|
||
| if (allStrokes == nullptr) |
Member
There was a problem hiding this comment.
winrt containers should never be null, so this test is unnecessary, instead empty (Size() == 0). Is there an API bug where it returns null?
|
|
||
| float3x2 matrixSacale = make_float3x2_scale(scale, topLeft); | ||
|
|
||
| for (auto stroke : allStrokes) |
| { | ||
| float3x2 matrix = make_float3x2_translation((float)position.X, (float)position.Y); | ||
|
|
||
| auto allStrokes = inkCanvas->InkPresenter->StrokeContainer->GetStrokes(); |
| if (allStrokes == nullptr) | ||
| return; | ||
|
|
||
| for (auto stroke : allStrokes) |
| void Scenario13::ClearSelection() | ||
| { | ||
| auto strokes = inkCanvas->InkPresenter->StrokeContainer->GetStrokes(); | ||
| for (auto stroke : strokes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We recently came across a question in the forums regarding an issue with someone selecting an inkstroke then trying to move and resize it. After digging through the samples I noticed that we didn't provide any guidance on how this could be done.
The team and I thought it would be a good idea to provide this sample, so I wrote an additional scenario that shows an approach that could be taken to accomplish this.
Essentially what happens is you highlight and select the Inkstoke. This creates a "selection" box around the item which you can mouse over. When you mouse over your mouse pointer changes to indicate the action that can be preformed, Either move or resize. Then you click and hold the mouse to preform your action.