Пример #1
0
 public function format(Node $node, Document $document)
 {
     $originalRatio = $node->getOriginalRatio();
     $currentRatio = $node->getCurrentRatio();
     if (!$this->floatEquals($originalRatio, $currentRatio)) {
         $width = $node->getWidth();
         $height = $node->getHeight();
         if ($originalRatio > $currentRatio) {
             $height = $originalRatio ? $width / $originalRatio : 0;
             $node->setHeight($height);
         } else {
             $width = $height * $originalRatio;
             $node->setWidth($width);
         }
     }
 }