Skip to content

Commit

Permalink
Merge pull request #555 from surger/patch-1
Browse files Browse the repository at this point in the history
Defining width & height of a shape don't return any error if width & height were equal to 0
  • Loading branch information
Progi1984 committed Oct 15, 2019
2 parents 6dc7fc2 + a4b5fce commit 344c779
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Bugfix
- PowerPoint2007 : Text is subscripted when set superscript to false - @qmachard GH-360
- Core : Defining width & height of a shape don't return any error if width & height were equal to 0 - @surger GH-555

### Changes
- Dropped support for HHVM - @sunspikes GH-556
Expand Down
4 changes: 2 additions & 2 deletions src/PhpPresentation/Shape/AbstractGraphic.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function setDescription($pValue = '')
public function setWidth($pValue = 0)
{
// Resize proportional?
if ($this->resizeProportional && $pValue != 0) {
if ($this->resizeProportional && $pValue != 0 && $this->width != 0) {
$ratio = $this->height / $this->width;
$this->height = (int) round($ratio * $pValue);
}
Expand All @@ -177,7 +177,7 @@ public function setWidth($pValue = 0)
public function setHeight($pValue = 0)
{
// Resize proportional?
if ($this->resizeProportional && $pValue != 0) {
if ($this->resizeProportional && $pValue != 0 && $this->height != 0) {
$ratio = $this->width / $this->height;
$this->width = (int) round($ratio * $pValue);
}
Expand Down

0 comments on commit 344c779

Please sign in to comment.