transform affects different object coordinate system
So I am trying to flip an image and a canvas within a Grid with other canvas and label, but other canvas object mouse move coordinate system is affected.
Using rendertransform.scaletransform to flip the image and a canvas also flips the coordinate system of the canvas with MeasurementControl (named CanvasOverlay). Just don't understand why.
My understanding is that a transform will act on the object it is contained in and not other objects. But clearly that is not the case.
One other key is that the interaction.trigger is changing the transform property ProbeAlignRight to either 1 or -1. This should flip the image and the canvas with ellipse and polygon. Problem is that CanvasOverlay is not flipped but when the control is moved it moves mirrored to the mouse. Clearly it is flipped the coordinate system from upper left 0,0 to upper right. This is so confusing.
<Grid>
<Image Name="usimagesrc" Source="{Binding UltrasoundImageSource, Converter={StaticResource nullValueConverter}}" Height="512" Width="512"
RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}"/>
</Image.RenderTransform>
</Image>
<Canvas RenderTransformOrigin="0.5,0.5" Focusable="True" Height="25" VerticalAlignment="Top">
<Ellipse x:Name="circleFrench" Height="25" Width="25" Fill="{DynamicResource StepperButtonBlueBorderBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Polygon Points="0,0 0.05,0.5 0,1 0.5,0.5" Fill="{DynamicResource StepperButtonBlueBorderBrush}" Width="25" Height="25" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="25" />
<Canvas.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}" />
</Canvas.RenderTransform>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown" >
<i:InvokeCommandAction Command="{Binding _flipImageCommandObj}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Canvas>
<Canvas>
<Label Canvas.Top="-2" Canvas.Left="18" Style="{DynamicResource InstructionsLabel}" Content="{lex:Loc DragMeasurementCircle}" Visibility="{Binding EnableMeasurementMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Canvas>
<Canvas x:Name="CFMBoxCanvas" ClipToBounds="True" />
<UIUtilities:UltrasoundDepthGauge x:Name="DepthGauge" Opacity=".4" DepthInCentimeters="{Binding DepthInCentimeters}"/>
<Canvas x:Name="CanvasOverlay" Visibility="{Binding EnableMeasureController, Converter={StaticResource BooleanToVisibilityConverter}}" >
<UIUtilities:MeasurementControl x:Name="MeasurementTool" Canvas.Top="100" Canvas.Left="300"/>
</Canvas>
<Label Content="{Binding DepthString}" Foreground="White" FontSize="16" FontWeight="Bold" VerticalAlignment="Bottom" HorizontalAlignment="Center" Background="Black"/>
</Grid>
wpf xaml canvas scaletransform
add a comment |
So I am trying to flip an image and a canvas within a Grid with other canvas and label, but other canvas object mouse move coordinate system is affected.
Using rendertransform.scaletransform to flip the image and a canvas also flips the coordinate system of the canvas with MeasurementControl (named CanvasOverlay). Just don't understand why.
My understanding is that a transform will act on the object it is contained in and not other objects. But clearly that is not the case.
One other key is that the interaction.trigger is changing the transform property ProbeAlignRight to either 1 or -1. This should flip the image and the canvas with ellipse and polygon. Problem is that CanvasOverlay is not flipped but when the control is moved it moves mirrored to the mouse. Clearly it is flipped the coordinate system from upper left 0,0 to upper right. This is so confusing.
<Grid>
<Image Name="usimagesrc" Source="{Binding UltrasoundImageSource, Converter={StaticResource nullValueConverter}}" Height="512" Width="512"
RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}"/>
</Image.RenderTransform>
</Image>
<Canvas RenderTransformOrigin="0.5,0.5" Focusable="True" Height="25" VerticalAlignment="Top">
<Ellipse x:Name="circleFrench" Height="25" Width="25" Fill="{DynamicResource StepperButtonBlueBorderBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Polygon Points="0,0 0.05,0.5 0,1 0.5,0.5" Fill="{DynamicResource StepperButtonBlueBorderBrush}" Width="25" Height="25" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="25" />
<Canvas.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}" />
</Canvas.RenderTransform>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown" >
<i:InvokeCommandAction Command="{Binding _flipImageCommandObj}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Canvas>
<Canvas>
<Label Canvas.Top="-2" Canvas.Left="18" Style="{DynamicResource InstructionsLabel}" Content="{lex:Loc DragMeasurementCircle}" Visibility="{Binding EnableMeasurementMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Canvas>
<Canvas x:Name="CFMBoxCanvas" ClipToBounds="True" />
<UIUtilities:UltrasoundDepthGauge x:Name="DepthGauge" Opacity=".4" DepthInCentimeters="{Binding DepthInCentimeters}"/>
<Canvas x:Name="CanvasOverlay" Visibility="{Binding EnableMeasureController, Converter={StaticResource BooleanToVisibilityConverter}}" >
<UIUtilities:MeasurementControl x:Name="MeasurementTool" Canvas.Top="100" Canvas.Left="300"/>
</Canvas>
<Label Content="{Binding DepthString}" Foreground="White" FontSize="16" FontWeight="Bold" VerticalAlignment="Bottom" HorizontalAlignment="Center" Background="Black"/>
</Grid>
wpf xaml canvas scaletransform
You make a good point
– dfiguerie
Nov 16 '18 at 10:13
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing.
– dfiguerie
Nov 17 '18 at 11:34
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing. The object in question does not have ScaleX applied to it, although in the z axis it sits atop a object that does. The numbers coming to OnMouseMove are as expected but the behavior or the UIElement is to go the opposite way as if I gave it an X of MAX rather than 0.
– dfiguerie
Nov 17 '18 at 11:44
add a comment |
So I am trying to flip an image and a canvas within a Grid with other canvas and label, but other canvas object mouse move coordinate system is affected.
Using rendertransform.scaletransform to flip the image and a canvas also flips the coordinate system of the canvas with MeasurementControl (named CanvasOverlay). Just don't understand why.
My understanding is that a transform will act on the object it is contained in and not other objects. But clearly that is not the case.
One other key is that the interaction.trigger is changing the transform property ProbeAlignRight to either 1 or -1. This should flip the image and the canvas with ellipse and polygon. Problem is that CanvasOverlay is not flipped but when the control is moved it moves mirrored to the mouse. Clearly it is flipped the coordinate system from upper left 0,0 to upper right. This is so confusing.
<Grid>
<Image Name="usimagesrc" Source="{Binding UltrasoundImageSource, Converter={StaticResource nullValueConverter}}" Height="512" Width="512"
RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}"/>
</Image.RenderTransform>
</Image>
<Canvas RenderTransformOrigin="0.5,0.5" Focusable="True" Height="25" VerticalAlignment="Top">
<Ellipse x:Name="circleFrench" Height="25" Width="25" Fill="{DynamicResource StepperButtonBlueBorderBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Polygon Points="0,0 0.05,0.5 0,1 0.5,0.5" Fill="{DynamicResource StepperButtonBlueBorderBrush}" Width="25" Height="25" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="25" />
<Canvas.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}" />
</Canvas.RenderTransform>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown" >
<i:InvokeCommandAction Command="{Binding _flipImageCommandObj}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Canvas>
<Canvas>
<Label Canvas.Top="-2" Canvas.Left="18" Style="{DynamicResource InstructionsLabel}" Content="{lex:Loc DragMeasurementCircle}" Visibility="{Binding EnableMeasurementMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Canvas>
<Canvas x:Name="CFMBoxCanvas" ClipToBounds="True" />
<UIUtilities:UltrasoundDepthGauge x:Name="DepthGauge" Opacity=".4" DepthInCentimeters="{Binding DepthInCentimeters}"/>
<Canvas x:Name="CanvasOverlay" Visibility="{Binding EnableMeasureController, Converter={StaticResource BooleanToVisibilityConverter}}" >
<UIUtilities:MeasurementControl x:Name="MeasurementTool" Canvas.Top="100" Canvas.Left="300"/>
</Canvas>
<Label Content="{Binding DepthString}" Foreground="White" FontSize="16" FontWeight="Bold" VerticalAlignment="Bottom" HorizontalAlignment="Center" Background="Black"/>
</Grid>
wpf xaml canvas scaletransform
So I am trying to flip an image and a canvas within a Grid with other canvas and label, but other canvas object mouse move coordinate system is affected.
Using rendertransform.scaletransform to flip the image and a canvas also flips the coordinate system of the canvas with MeasurementControl (named CanvasOverlay). Just don't understand why.
My understanding is that a transform will act on the object it is contained in and not other objects. But clearly that is not the case.
One other key is that the interaction.trigger is changing the transform property ProbeAlignRight to either 1 or -1. This should flip the image and the canvas with ellipse and polygon. Problem is that CanvasOverlay is not flipped but when the control is moved it moves mirrored to the mouse. Clearly it is flipped the coordinate system from upper left 0,0 to upper right. This is so confusing.
<Grid>
<Image Name="usimagesrc" Source="{Binding UltrasoundImageSource, Converter={StaticResource nullValueConverter}}" Height="512" Width="512"
RenderTransformOrigin="0.5,0.5">
<Image.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}"/>
</Image.RenderTransform>
</Image>
<Canvas RenderTransformOrigin="0.5,0.5" Focusable="True" Height="25" VerticalAlignment="Top">
<Ellipse x:Name="circleFrench" Height="25" Width="25" Fill="{DynamicResource StepperButtonBlueBorderBrush}" HorizontalAlignment="Left" VerticalAlignment="Top" />
<Polygon Points="0,0 0.05,0.5 0,1 0.5,0.5" Fill="{DynamicResource StepperButtonBlueBorderBrush}" Width="25" Height="25" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" Canvas.Left="25" />
<Canvas.RenderTransform>
<ScaleTransform ScaleX="{Binding ProbeAlignRight}" />
</Canvas.RenderTransform>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDown" >
<i:InvokeCommandAction Command="{Binding _flipImageCommandObj}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Canvas>
<Canvas>
<Label Canvas.Top="-2" Canvas.Left="18" Style="{DynamicResource InstructionsLabel}" Content="{lex:Loc DragMeasurementCircle}" Visibility="{Binding EnableMeasurementMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</Canvas>
<Canvas x:Name="CFMBoxCanvas" ClipToBounds="True" />
<UIUtilities:UltrasoundDepthGauge x:Name="DepthGauge" Opacity=".4" DepthInCentimeters="{Binding DepthInCentimeters}"/>
<Canvas x:Name="CanvasOverlay" Visibility="{Binding EnableMeasureController, Converter={StaticResource BooleanToVisibilityConverter}}" >
<UIUtilities:MeasurementControl x:Name="MeasurementTool" Canvas.Top="100" Canvas.Left="300"/>
</Canvas>
<Label Content="{Binding DepthString}" Foreground="White" FontSize="16" FontWeight="Bold" VerticalAlignment="Bottom" HorizontalAlignment="Center" Background="Black"/>
</Grid>
wpf xaml canvas scaletransform
wpf xaml canvas scaletransform
edited Nov 16 '18 at 11:09
dfiguerie
asked Nov 16 '18 at 2:39
dfigueriedfiguerie
112
112
You make a good point
– dfiguerie
Nov 16 '18 at 10:13
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing.
– dfiguerie
Nov 17 '18 at 11:34
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing. The object in question does not have ScaleX applied to it, although in the z axis it sits atop a object that does. The numbers coming to OnMouseMove are as expected but the behavior or the UIElement is to go the opposite way as if I gave it an X of MAX rather than 0.
– dfiguerie
Nov 17 '18 at 11:44
add a comment |
You make a good point
– dfiguerie
Nov 16 '18 at 10:13
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing.
– dfiguerie
Nov 17 '18 at 11:34
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing. The object in question does not have ScaleX applied to it, although in the z axis it sits atop a object that does. The numbers coming to OnMouseMove are as expected but the behavior or the UIElement is to go the opposite way as if I gave it an X of MAX rather than 0.
– dfiguerie
Nov 17 '18 at 11:44
You make a good point
– dfiguerie
Nov 16 '18 at 10:13
You make a good point
– dfiguerie
Nov 16 '18 at 10:13
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing.
– dfiguerie
Nov 17 '18 at 11:34
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing.
– dfiguerie
Nov 17 '18 at 11:34
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing. The object in question does not have ScaleX applied to it, although in the z axis it sits atop a object that does. The numbers coming to OnMouseMove are as expected but the behavior or the UIElement is to go the opposite way as if I gave it an X of MAX rather than 0.
– dfiguerie
Nov 17 '18 at 11:44
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing. The object in question does not have ScaleX applied to it, although in the z axis it sits atop a object that does. The numbers coming to OnMouseMove are as expected but the behavior or the UIElement is to go the opposite way as if I gave it an X of MAX rather than 0.
– dfiguerie
Nov 17 '18 at 11:44
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330667%2ftransform-affects-different-object-coordinate-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330667%2ftransform-affects-different-object-coordinate-system%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You make a good point
– dfiguerie
Nov 16 '18 at 10:13
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing.
– dfiguerie
Nov 17 '18 at 11:34
I was unable to comprehend the fix and worked around it by flipping the X coordinates in the OnMouseMove method. It has just been perplexing. The object in question does not have ScaleX applied to it, although in the z axis it sits atop a object that does. The numbers coming to OnMouseMove are as expected but the behavior or the UIElement is to go the opposite way as if I gave it an X of MAX rather than 0.
– dfiguerie
Nov 17 '18 at 11:44