Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d6f1da9

Browse files
authoredMar 26, 2018
Merge pull request #15 from Dunkhan/issue14Fix
Fixed #14, prevents crash when resized to zero dimensions
2 parents e4e839a + 9d6e3d1 commit d6f1da9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ All notable changes to this project will be documented in this file.
1515
- Image Annotations (#7)
1616
- MeasureText fixed in cases where string is null or empty
1717
- Fixed render extent not being set in ArrangeOverride step on WPF (#12)
18+
- Fixed zero dimensions crashing plot (#14)

‎Source/OxyPlot.SharpDX.Wpf/PlotImage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,8 @@ private void InitRendering()
591591
dpiScale = hwndTarget.TransformToDevice.M11;
592592
}
593593

594-
int surfWidth = (int)(this.viewport.Width < 0 ? 0 : Math.Ceiling(this.viewport.Width * dpiScale));
595-
int surfHeight = (int)(this.viewport.Height < 0 ? 0 : Math.Ceiling(this.viewport.Height * dpiScale));
594+
int surfWidth = (int)(this.viewport.Width <= 0 ? 1 : Math.Ceiling(this.viewport.Width * dpiScale));
595+
int surfHeight = (int)(this.viewport.Height <= 0 ? 1 : Math.Ceiling(this.viewport.Height * dpiScale));
596596

597597
var windowHandle = (new WindowInteropHelper(Window.GetWindow(this))).Handle;
598598

0 commit comments

Comments
 (0)