FreehandAnnotProperty.xaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <UserControl
  2. x:Class="PDF_Office.Views.PropertyPanel.AnnotPanel.FreehandAnnotProperty"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:CompositeControl="clr-namespace:PDF_Office.CustomControl.CompositeControl"
  6. xmlns:Convert="clr-namespace:PDF_Office.DataConvert"
  7. xmlns:EraseThickConvert="clr-namespace:PDF_Office.ViewModels.PropertyPanel.AnnotPanel"
  8. xmlns:cus="clr-namespace:PDF_Office.CustomControl"
  9. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  10. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  11. xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.AnnotPanel"
  12. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  13. xmlns:prism="http://prismlibrary.com/"
  14. d:DataContext="{d:DesignInstance Type=EraseThickConvert:FreehandAnnotPropertyViewModel}"
  15. d:DesignHeight="450"
  16. d:DesignWidth="260"
  17. Background="{StaticResource color.sys.layout.mg}"
  18. mc:Ignorable="d">
  19. <UserControl.Resources>
  20. <ResourceDictionary>
  21. <ResourceDictionary.MergedDictionaries>
  22. <ResourceDictionary Source="../../../Styles/SliderStyle.xaml" />
  23. <ResourceDictionary Source="../../../Styles/CustomBtnStyle.xaml" />
  24. </ResourceDictionary.MergedDictionaries>
  25. <Convert:InvertBoolConvert x:Key="InvertBoolConvert" />
  26. <Convert:BoolToVisible x:Key="BoolToVisible" />
  27. <Convert:InvertBoolToVisibleConvert x:Key="InvertBoolToVisibleConvert" />
  28. <Convert:CheckToVisibleMutiConvert x:Key="CheckToVisibleMutiConvert" />
  29. <EraseThickConvert:EraseThicknessConverter x:Key="EraseThicknessConverter" />
  30. <Style x:Key="lineStyle" TargetType="{x:Type Line}">
  31. <Setter Property="Visibility">
  32. <Setter.Value>
  33. <MultiBinding Converter="{StaticResource CheckToVisibleMutiConvert}">
  34. <Binding ElementName="PenBtn" Path="IsChecked" />
  35. <Binding ElementName="EraseBtn" Path="IsChecked" />
  36. </MultiBinding>
  37. </Setter.Value>
  38. </Setter>
  39. </Style>
  40. </ResourceDictionary>
  41. </UserControl.Resources>
  42. <Grid Margin="16,0,16,0">
  43. <StackPanel>
  44. <TextBlock
  45. Name="AnnotTypeTitle"
  46. Margin="10,8,0,0"
  47. HorizontalAlignment="Left"
  48. FontFamily="SegoeUI"
  49. FontSize="18"
  50. FontWeight="Bold"
  51. LineHeight="24"
  52. Text="{Binding BasicVm.AnnotTypeTitle}" />
  53. <Border
  54. Width="224"
  55. Height="28"
  56. Margin="0,16,0,0"
  57. Padding="2"
  58. Background="{StaticResource color.sys.layout.fg.dark}"
  59. CornerRadius="4"
  60. Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
  61. <StackPanel Orientation="Horizontal">
  62. <RadioButton
  63. x:Name="PenBtn"
  64. Width="112"
  65. Height="28"
  66. Padding="0"
  67. HorizontalContentAlignment="Center"
  68. VerticalContentAlignment="Center"
  69. Command="{Binding PenCommand}"
  70. CommandParameter="{Binding ElementName=PenBtn}"
  71. GroupName="Mode"
  72. IsChecked="{Binding IsPen}"
  73. Style="{StaticResource ListModeRadioBtnStyle}"
  74. Tag="GridMode"
  75. ToolTip="画笔">
  76. <Image Width="16" Height="16">
  77. <Image.Source>
  78. <DrawingImage>
  79. <DrawingImage.Drawing>
  80. <DrawingGroup ClipGeometry="M0,0 V16 H17 V0 H0 Z">
  81. <DrawingGroup.Transform>
  82. <TranslateTransform X="0" Y="2.3891999489933369E-13" />
  83. </DrawingGroup.Transform>
  84. <DrawingGroup Opacity="1">
  85. <DrawingGroup Opacity="1" Transform="1,0,0,1,-1759,-284">
  86. <DrawingGroup Opacity="1" Transform="1,0,0,1,1664,144">
  87. <DrawingGroup Opacity="1" Transform="1,0,0,1,79,132">
  88. <DrawingGroup Opacity="1" Transform="1,0,0,1,16.5,7">
  89. <DrawingGroup Opacity="1" Transform="1,0,0,1,0,0.601398">
  90. <DrawingGroup Transform="0.707106781186548,0.707106781186547,-0.707106781186547,0.707106781186548,7.88325217719452,-3.03185432179024">
  91. <GeometryDrawing Brush="{Binding ElementName=PenBtn, Path=Foreground}" Geometry="F0 M17,16z M0,0z M9.3513979,-2.38919995E-13C9.90368265,-2.38919995E-13,10.3513979,0.450295066,10.3513979,1.00576218L10.3513979,1.00576218 10.3513979,11.8051336 7.6013979,16 4.8513979,11.8051336 4.8513979,1.00576218C4.8513979,0.450295066,5.29911315,-2.38919995E-13,5.8513979,-2.38919995E-13L5.8513979,-2.38919995E-13z M7.60473447,11.7101997C7.11907276,11.7101997,6.63199763,11.78823,6.14217677,11.9453384L7.60173447,14.1723055 9.06200843,11.9436467C8.57396851,11.7876698,8.08864986,11.7101997,7.60473447,11.7101997z M9.3513979,3.161L5.8513979,3.161 5.85115502,10.9830388C6.43339754,10.7976506 7.01836385,10.7044375 7.60473447,10.7044375 8.18875558,10.7044375 8.77138361,10.7969051 9.35131488,10.9808148L9.3513979,3.161z M9.3513979,1.00576218L5.8513979,1.00576218 5.8513979,2.155 9.3513979,2.155 9.3513979,1.00576218z" />
  92. </DrawingGroup>
  93. <GeometryDrawing Brush="{Binding ElementName=PenBtn, Path=Foreground}" Geometry="F0 M17,16z M0,0z M1.29862352,15.7862914L1,14.829082 2.11583633,14.4674158 3.15406592,14.1429482 3.80363818,13.9473535 4.41951961,13.7683686 5.28087243,13.5311015 5.81392871,13.3937753 6.31441568,13.2731665 6.78265376,13.1693059 7.21896338,13.0822242 7.62366497,13.0119522C7.68849903,13.0016428,7.75202945,12.992035,7.81426289,12.9831295L8.17215324,12.9381299C8.28629773,12.9259427,8.39530772,12.91657,8.49923663,12.9100169L8.79583349,12.8988214C9.26493417,12.8942772 9.60834275,12.9603508 9.83273483,13.0976833 10.068274,13.2418381 10.2415014,13.4084688 10.3508877,13.6058206 10.5552187,13.9744691 10.5216162,14.2710014 10.3376925,14.6810881L10.2229683,14.9193983C10.2817235,14.9238084,10.3581498,14.9219184,10.4516286,14.9136535L10.6611397,14.8886018 10.9150249,14.8464174 11.2121845,14.7869671C11.2652562,14.7756125,11.3200852,14.7635329,11.3766486,14.7507256L11.7366584,14.6651269 12.137194,14.5619295 12.5771557,14.4410004 13.3086174,14.2260685 13.8423344,14.0602276 14.4116293,13.8761891 14.6967022,13.7815159 15,14.7371732 14.0940685,15.0341015 13.5390453,15.2080944 13.0222263,15.3628032 12.5428049,15.498128 12.0999746,15.6139689 11.692929,15.710226C11.6280253,15.7246313,11.5645791,15.7382165,11.5025734,15.7509794L11.1476927,15.8176735C10.3593478,15.9501927 9.84677889,15.9207377 9.56388238,15.7235969 9.07242318,15.3811161 9.08228965,15.0467022 9.33958239,14.4900411L9.46369549,14.2289552 9.49505041,14.1493245C9.5039287,14.1213806 9.50387062,14.1091441 9.50055695,14.1031657 9.48301036,14.0715086 9.43206472,14.022503 9.33190506,13.9612033 9.23927091,13.9045093 9.07240971,13.8771492 8.83379185,13.8793603L8.61174683,13.888503 8.3549014,13.9121628 8.06360129,13.9503729 7.73819222,14.0031665 7.37901988,14.0705767 6.98643,14.152637 6.5607683,14.2493803 6.10238048,14.36084 5.61161226,14.4870492 4.81550294,14.7040912 3.94848235,14.9545065 2.68416517,15.3405013 1.65622248,15.6692235 1.29862352,15.7862914z" />
  94. </DrawingGroup>
  95. </DrawingGroup>
  96. </DrawingGroup>
  97. </DrawingGroup>
  98. </DrawingGroup>
  99. </DrawingGroup>
  100. </DrawingGroup>
  101. </DrawingImage.Drawing>
  102. </DrawingImage>
  103. </Image.Source>
  104. </Image>
  105. </RadioButton>
  106. <RadioButton
  107. x:Name="EraseBtn"
  108. Width="112"
  109. Height="28"
  110. Padding="0"
  111. HorizontalContentAlignment="Center"
  112. VerticalContentAlignment="Center"
  113. Command="{Binding EraseCommand}"
  114. CommandParameter="{Binding ElementName=EraseBtn}"
  115. GroupName="Mode"
  116. IsChecked="{Binding IsPen, Converter={StaticResource InvertBoolConvert}}"
  117. Style="{StaticResource ListModeRadioBtnStyle}"
  118. Tag="ListMode"
  119. ToolTip="橡皮擦">
  120. <Path
  121. Width="16"
  122. Height="16"
  123. HorizontalAlignment="Center"
  124. VerticalAlignment="Center"
  125. Data="M11,1.796875 L16.703125,7.5 L9.2109375,15 L5.0390625,15 L2.3984375, 12.3515625 L2.30688477,12.2502441 C2.22143555,12.1452637 2.15429688,12.0292969 2.10546875,11.9023438 C2.04036458,11.7330729 2.0078125,11.5572917 2.0078125, 11.375 C2.0078125,11.1927083 2.04036458,11.0169271 2.10546875,10.8476562 C2.15429688,10.7207031 2.2199707, 10.6062012 2.30249023,10.5041504 L2.390625,10.40625 L11,1.796875 Z M17.5,14 L17.5,15 L10.5,15 L11.5181818, 14 L17.5,14 Z M2.56227106,14 L3.5,15 L1.5,15 L1.5,14 L2.56227106,14 Z M5,9.203125 L3.1015625,11.1015625 L3.05712891, 11.1567383 C3.01904297,11.2163086 3,11.2890625 3,11.375 C3,11.4609375 3.02050781,11.5351562 3.06152344,11.5976562 L3.109375, 11.65625 L5.453125,14 L8.7890625,14 L9.296875,13.5 L5,9.203125 Z M11,3.203125 L5.703125,8.5 L10,12.796875 L15.296875,7.5 L11,3.203125 Z"
  126. Fill="{Binding ElementName=EraseBtn, Path=Foreground}" />
  127. </RadioButton>
  128. </StackPanel>
  129. </Border>
  130. <Border
  131. Width="228"
  132. Height="100"
  133. Margin="0,8,0,0"
  134. Background="White"
  135. BorderBrush="#DDDDDD"
  136. BorderThickness="1"
  137. CornerRadius="2"
  138. Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
  139. <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
  140. <Path
  141. Name="FreehandPath"
  142. Data="M1 25C5.12875 18.3502 10.3975 12.6666 16.9494 8.65676C22.3906 5.32666 29.6822 4.41812 35.8348 5.34323C50.1181 7.49086 60.8395 19.2854 74.6384 22.835C80.312 24.2945 86.1855 25.2489 91.8692 23.3366C96.737 21.6988 101.081 18.9771 104.932 15.4686C109.678 11.1449 114.025 6.91941 117 1"
  143. Stroke="{Binding BasicVm.FontColor}"
  144. StrokeDashArray="{Binding StrokeDashArray}"
  145. StrokeThickness="{Binding BasicVm.AnnotThickness}"
  146. Visibility="{Binding IsPen, Converter={StaticResource BoolToVisible}}" />
  147. <Ellipse
  148. Name="ErasePath"
  149. Width="{Binding EraseThicknessLine, Converter={StaticResource EraseThicknessConverter}}"
  150. Height="{Binding EraseThicknessLine, Converter={StaticResource EraseThicknessConverter}}"
  151. HorizontalAlignment="Center"
  152. VerticalAlignment="Center"
  153. Fill="#1A000000"
  154. Visibility="{Binding IsPen, Converter={StaticResource InvertBoolToVisibleConvert}}" />
  155. </Grid>
  156. </Border>
  157. <StackPanel x:Name="PnlPen" Visibility="{Binding IsPen, Converter={StaticResource BoolToVisible}}">
  158. <Grid Margin="0,18,0,0">
  159. <Grid.RowDefinitions>
  160. <RowDefinition Height="auto" />
  161. <RowDefinition />
  162. </Grid.RowDefinitions>
  163. <TextBlock
  164. FontFamily="Segoe UI"
  165. FontSize="12"
  166. Foreground="{StaticResource color.sys.text.neutral.lv2}"
  167. Text="Color" />
  168. <CompositeControl:SlidContent
  169. x:Name="layerThick"
  170. HorizontalAlignment="Right"
  171. InitValue="{Binding BasicVm.FillOpacity, Mode=OneWay}"
  172. Visibility="{Binding BasicVm.IsMultiSelected, Converter={StaticResource InvertBoolToVisibleConvert}}">
  173. <i:Interaction.Triggers>
  174. <i:EventTrigger EventName="SelectedValueChanged">
  175. <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerThick, Path=Value}" />
  176. </i:EventTrigger>
  177. </i:Interaction.Triggers>
  178. </CompositeControl:SlidContent>
  179. <CompositeControl:ColorContent
  180. x:Name="cusColor"
  181. Grid.Row="1"
  182. Margin="0,8,0,0"
  183. ColorType="Border"
  184. ItemSource="{Binding BasicVm.ColorItems}"
  185. UIColor="{Binding BasicVm.CurrentFontColor, Mode=OneWay}">
  186. <i:Interaction.Triggers>
  187. <i:EventTrigger EventName="SelectedColorInvoke">
  188. <i:InvokeCommandAction Command="{Binding SelectedColorChangedCommand}" CommandParameter="{Binding ElementName=cusColor, Path=SelectedColor}" />
  189. </i:EventTrigger>
  190. </i:Interaction.Triggers>
  191. </CompositeControl:ColorContent>
  192. </Grid>
  193. <CompositeControl:SlidComboControl
  194. x:Name="thickness"
  195. Margin="0,0,0,0"
  196. ItemsSource="{Binding PenSizeItems}"
  197. Value="{Binding BasicVm.AnnotThickness, Mode=TwoWay}">
  198. <i:Interaction.Triggers>
  199. <i:EventTrigger EventName="ValueChanged">
  200. <i:InvokeCommandAction Command="{Binding SelectPenThickChangedCommand}" CommandParameter="{Binding ElementName=thickness, Path=Value}" />
  201. </i:EventTrigger>
  202. </i:Interaction.Triggers>
  203. </CompositeControl:SlidComboControl>
  204. <StackPanel Margin="0,20,0,0" Orientation="Horizontal">
  205. <RadioButton
  206. x:Name="BtnSolid"
  207. Width="105"
  208. Height="32"
  209. Margin="0,0,10,0"
  210. VerticalContentAlignment="Center"
  211. Background="Transparent"
  212. Command="{Binding LineModeCheckedCommand}"
  213. CommandParameter="{Binding ElementName=BtnSolid, Path=Tag}"
  214. Foreground="#616469"
  215. GroupName="LineMode"
  216. IsChecked="{Binding BasicVm.IsSolidLine,Mode=TwoWay}"
  217. Style="{DynamicResource GreyBgRadioBtnStyle}"
  218. Tag="Solid">
  219. <RadioButton.Content>
  220. <Line
  221. Stroke="Black"
  222. StrokeThickness="2"
  223. X1="10"
  224. X2="90"
  225. Y1="5"
  226. Y2="5" />
  227. </RadioButton.Content>
  228. </RadioButton>
  229. <RadioButton
  230. x:Name="BtnDashed"
  231. Width="105"
  232. Height="32"
  233. Margin="0,0"
  234. VerticalContentAlignment="Center"
  235. Background="Transparent"
  236. Command="{Binding LineModeCheckedCommand}"
  237. CommandParameter="{Binding ElementName=BtnDashed, Path=Tag}"
  238. Foreground="#616469"
  239. GroupName="LineMode"
  240. IsChecked="{Binding BasicVm.IsDashLine,Mode=TwoWay}"
  241. Style="{DynamicResource GreyBgRadioBtnStyle}"
  242. Tag="Dashed">
  243. <RadioButton.Content>
  244. <Line
  245. Stroke="Black"
  246. StrokeDashArray="2"
  247. StrokeThickness="2"
  248. X1="10"
  249. X2="90"
  250. Y1="5"
  251. Y2="5" />
  252. </RadioButton.Content>
  253. </RadioButton>
  254. </StackPanel>
  255. </StackPanel>
  256. <StackPanel x:Name="PnlEraser" Visibility="{Binding IsPen, Converter={StaticResource InvertBoolToVisibleConvert}}">
  257. <CompositeControl:SlidComboControl
  258. x:Name="Eraserthickness"
  259. HorizontalAlignment="Stretch"
  260. ItemsSource="{Binding EraserSizeItems}"
  261. Value="{Binding EraseThicknessLine, Mode=TwoWay}">
  262. <i:Interaction.Triggers>
  263. <i:EventTrigger EventName="ValueChanged">
  264. <i:InvokeCommandAction Command="{Binding SetEraserThickCommand}" CommandParameter="{Binding ElementName=Eraserthickness, Path=Value}" />
  265. </i:EventTrigger>
  266. </i:Interaction.Triggers>
  267. </CompositeControl:SlidComboControl>
  268. </StackPanel>
  269. </StackPanel>
  270. </Grid>
  271. </UserControl>