Skip to content

Commit 5abe106

Browse files
committed
2 parents ca6da26 + 1cfd10b commit 5abe106

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

Samples/ClipArtViewer/MainWindow.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@
109109
<Grid Margin="3">
110110
<Grid.ColumnDefinitions>
111111
<ColumnDefinition Width="330"/>
112+
<ColumnDefinition Width="Auto" />
112113
<ColumnDefinition />
113114
</Grid.ColumnDefinitions>
114-
<ListBox Name="m_filelist" Grid.Row="1" ItemsSource="{Binding Path=Items}" Margin="3" Padding="3">
115+
<ListBox Name="m_filelist" Grid.Row="1" ItemsSource="{Binding Path=Items}" Margin="3, 3, 9, 3" Padding="3">
115116
<ListBox.ItemTemplate>
116117
<DataTemplate>
117118
<StackPanel Orientation="Horizontal" Margin="5">
@@ -127,8 +128,10 @@
127128
</ContextMenu>
128129
</ListBox.ContextMenu>
129130
</ListBox>
130-
131-
<TabControl Grid.Column="1" Grid.Row="1" Margin="3" x:Name="tabControl"
131+
132+
<GridSplitter Grid.Column="0" Name="gridSplitter1" Width="8" Background="LightGray" />
133+
134+
<TabControl Grid.Column="2" Grid.Row="1" Margin="3" x:Name="tabControl"
132135
SelectionChanged="OnTabControlSelectionChanged" Style="{DynamicResource TabControl.Style.TopTabStripPlacement}">
133136
<TabItem Header="Size Type" Height="36" Width="120" x:Name="tabSizeType" Style="{DynamicResource TabItem.Style.TopTabStripPlacement}">
134137
<local:SizeTypeForm x:Name="m_sizeTypeForm" ImageSource="{Binding ElementName=m_filelist, Path=SelectedItem.SVGImage}"/>

Source/SVGImage/SVG/SVGRender.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,27 @@ internal DrawingGroup LoadGroup(IList<Shape> elements, Rect? viewBox, bool isSwi
364364
if (shape is RectangleShape)
365365
{
366366
RectangleShape r = shape as RectangleShape;
367-
RectangleGeometry rect = new RectangleGeometry(new Rect(r.X < 0 ? 0 : r.X, r.Y < 0 ? 0 : r.Y, r.X < 0 ? r.Width + r.X : r.Width, r.Y < 0 ? r.Height + r.Y : r.Height));
368-
rect.RadiusX = r.RX;
369-
rect.RadiusY = r.RY;
370-
if (rect.RadiusX == 0 && rect.RadiusY > 0) rect.RadiusX = rect.RadiusY;
367+
//RectangleGeometry rect = new RectangleGeometry(new Rect(r.X < 0 ? 0 : r.X, r.Y < 0 ? 0 : r.Y, r.X < 0 ? r.Width + r.X : r.Width, r.Y < 0 ? r.Height + r.Y : r.Height));
368+
double dx = r.X;
369+
double dy = r.Y;
370+
double width = r.Width;
371+
double height = r.Height;
372+
double rx = r.RX;
373+
double ry = r.RY;
374+
if (width <= 0 || height <= 0)
375+
{
376+
continue;
377+
}
378+
if (rx <= 0 && ry > 0)
379+
{
380+
rx = ry;
381+
}
382+
else if (rx > 0 && ry <= 0)
383+
{
384+
ry = rx;
385+
}
386+
387+
RectangleGeometry rect = new RectangleGeometry(new Rect(dx, dy, width, height), rx, ry);
371388
var di = this.NewDrawingItem(shape, rect);
372389
AddDrawingToGroup(grp, shape, di);
373390
continue;

0 commit comments

Comments
 (0)