use Fluidbook\Tools\SVG\SVGTools;
use Illuminate\Support\Facades\Log;
-class ZoomLink extends NormalLink {
+class ZoomLink extends NormalLink
+{
protected $maxzoom_default = 2;
protected $_groups = null;
- public function ignore() {
+ public function ignore()
+ {
return parent::ignore() || $this->isOutsidePage();
}
- public function getGroups() {
+ public function getGroups()
+ {
if (null === $this->_groups) {
$this->_groups = [];
$groups = explode(',', $this->group);
return $this->_groups;
}
- public function init() {
+ public function init()
+ {
$this->compiler->addJsLib('fluidbook-zoom', 'js/libs/fluidbook/links/fluidbook.links.zoom.js');
$this->maxzoom_default = $this->compiler->getSetting('zoomAreaDefaultZoomLevel', 2);
parent::init();
}
- public function getHTMLContainerClass() {
+ public function getHTMLContainerClass()
+ {
$class = ' zoomarea';
$groups = $this->getGroups();
return parent::getHTMLContainerClass() . $class;
}
- public function getDefaultTooltip() {
+ public function getDefaultTooltip()
+ {
return 'zoom in';
}
- public function getAdditionnalContent() {
+ public function getAdditionnalContent()
+ {
$res = parent::getAdditionnalContent();
$res .= ' id="' . $this->uid . '"';
return $res;
}
- public function getZoomAttributes() {
+ public function getZoomAttributes()
+ {
return [
'id' => $this->uid,
'page' => $this->page,
* @param $save
* @return string
*/
- public static function generateImage($attributes, $compiler, $cachedir, $save, $trim = false,$copy=true) {
+ public static function generateImage($attributes, $compiler, $cachedir, $save, $trim = false, $copy = true)
+ {
$maxzoom = $attributes['maxzoom']; // Max zoom level might not always be set in the link editor
+ if (!is_numeric($maxzoom)) {
+ $maxzoom = 4;
+ }
$maxzoom = max(0, min($maxzoom, 20));
if (!$maxzoom) {
$maxzoom = 2;
$cache = $compiler->getCacheDir("zoomarea/" . $cachedir);
-
$leftHeight = min($h, $compiler->getHeightForLinks($attributes['page']) - $y);
$leftWidth = min($w, $compiler->getWidthForLinks($attributes['page']) - $x);
Log::error('Failed generate image ' . json_encode($attributes));
}
$dest = 'data/links/' . $save . '_' . $attributes['id'] . '.' . $ext;
- if($copy) {
+ if ($copy) {
$compiler->simpleCopyLinkFile($both, $dest);
}
return $both;
}
- public function getClasses() {
+ public function getClasses()
+ {
// Assign CSS classes for all groups so we can match and group them via JS
$groups = $this->getGroups();
$group_classes = [];