-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new Sample Scenario - InkStroke - Resize and Move selected InkStroke #1189
base: main
Are you sure you want to change the base?
Add new Sample Scenario - InkStroke - Resize and Move selected InkStroke #1189
Conversation
…oke that has been selected using lasso tool
added comments, removed redundant code, changed order of methods. etc.
Windows::Foundation::EventRegistrationToken pointerExitedRectangleToken; | ||
Windows::Foundation::EventRegistrationToken pointerMovedRectangleToken; | ||
Windows::Foundation::EventRegistrationToken pointerPressedRectangleToken; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete extra blank lines
Scenario13::Scenario13() | ||
{ | ||
InitializeComponent(); | ||
LassoSelect = (Symbol)0xEF20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use static_cast
if (currentManipulationType != ManipulationTypes::None) | ||
return; | ||
|
||
Windows::UI::Core::CoreWindow^ window = Windows::UI::Core::CoreWindow::GetForCurrentThread(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto window = ...
/// <param name="e"></param> | ||
void Scenario13::SelectionRectangle_ManipulationDelta(Object^ sender, Windows::UI::Xaml::Input::ManipulationDeltaRoutedEventArgs^ e) | ||
{ | ||
CompositeTransform^ transform = (CompositeTransform^)selectionRectangle->RenderTransform; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto transform = ...
, use safe_cast
break; | ||
|
||
case ManipulationTypes::Size: | ||
//Example Scaling factor used to determine the speed at which the box will grow/shrink. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment needs editing, This will prevent...
|
||
auto allStrokes = inkCanvas->InkPresenter->StrokeContainer->GetStrokes(); | ||
|
||
if (allStrokes == nullptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto& stroke : ...
{ | ||
float3x2 matrix = make_float3x2_translation((float)position.X, (float)position.Y); | ||
|
||
auto allStrokes = inkCanvas->InkPresenter->StrokeContainer->GetStrokes(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indent
if (allStrokes == nullptr) | ||
return; | ||
|
||
for (auto stroke : allStrokes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto const&
void Scenario13::ClearSelection() | ||
{ | ||
auto strokes = inkCanvas->InkPresenter->StrokeContainer->GetStrokes(); | ||
for (auto stroke : strokes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const auto&
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.