From 97b274dfe826db5e070aecec226b326e6ebc7b4d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 26 Apr 2023 09:20:38 +0200 Subject: [PATCH] wait #5883 @0.5 --- resources/linkeditor/js/linkeditor.links.js | 25 +++++++++++++++---- .../link_editor.blade.php | 21 ++++++++++++---- .../link_editor_icons.blade.php | 2 +- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index d061aa784..1373d9631 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -1033,7 +1033,7 @@ LinkeditorLinks.prototype = { }, alignSelection: function (align) { - let d = this.getMinMaxSelection(align) + let d = this.getMinMaxSelection(align); if (align === 'left' || align === 'top') { this.getCurrentSelection().each(function () { $(this).attr('fb-' + d.side, d.min); @@ -1052,6 +1052,15 @@ LinkeditorLinks.prototype = { this.linkeditor.hasChanged(); }, + dimensionSelection: function (dimension) { + let d = this.getMinMaxSelection(dimension); + this.getCurrentSelection().each(function () { + $(this).attr('fb-' + dimension, d.maxl); + }); + this.updateSelectionData([dimension]); + this.linkeditor.hasChanged(); + }, + updateLinkData: function (id, data) { if (LINKS[id] === undefined) { console.warn('Link ' + id + ' not found'); @@ -1100,7 +1109,7 @@ LinkeditorLinks.prototype = { }, getMinMaxSelection: function (axis) { - if (axis === 'left' || axis === 'right' || axis === 'center') { + if (axis === 'left' || axis === 'right' || axis === 'center' || axis === 'width') { axis = 'x'; } else if (axis === 'top' || axis === 'bottom' || axis === 'middle') { axis = 'y;' @@ -1109,12 +1118,18 @@ LinkeditorLinks.prototype = { var b = axis === 'x' ? 'left' : 'top'; var l = axis === 'x' ? 'width' : 'height'; var max = -100000000; + var maxl = max; var min = 100000000; + var minl = minl; this.getCurrentSelection().each(function () { - min = Math.min(min, parseFloat($(this).attr('fb-' + b))); - max = Math.max(max, parseFloat($(this).attr('fb-' + b)) + parseFloat($(this).attr('fb-' + l))); + let vb = parseFloat($(this).attr('fb-' + b)); + let vl = parseFloat($(this).attr('fb-' + l)); + min = Math.min(min, vb); + minl = Math.min(minl, vl); + max = Math.max(max, vb + vl); + maxl = Math.max(maxl, vl); }); - return {min: min, max: max, side: b, length: l}; + return {min: min, max: max, minl: minl, maxl: maxl, side: b, length: l}; }, coverPage(margin, double) { diff --git a/resources/views/fluidbook_publication/link_editor.blade.php b/resources/views/fluidbook_publication/link_editor.blade.php index e007ccd6b..d4947139b 100644 --- a/resources/views/fluidbook_publication/link_editor.blade.php +++ b/resources/views/fluidbook_publication/link_editor.blade.php @@ -76,11 +76,16 @@ $alignments=[ 'left'=>__('Aligner la sélection à gauche'), - 'center'=>__('Centrer horizontalement la sélection'), - 'right'=>__('Aligner la sélection à droite'), - 'top'=>__('Aligner la sélection en haut'), - 'middle'=>__('Centrer verticalement la sélection'), - 'bottom'=>__('Aligner la sélection en bas') + 'center'=>__('Centrer horizontalement la sélection'), + 'right'=>__('Aligner la sélection à droite'), + 'top'=>__('Aligner la sélection en haut'), + 'middle'=>__('Centrer verticalement la sélection'), + 'bottom'=>__('Aligner la sélection en bas') + ]; + $dimensions=[ + 'width'=>__('Appliquer la même largeur à la sélection'), + 'height'=>__('Appliquer la même hauteur à la sélection'), + 'both'=>__('Appliquer les mêmes dimensions à la sélection'), ]; @@ -242,6 +247,12 @@ data-tooltip="{{$label}}" data-icon="align-{{$a}}"> @endforeach +
+ @foreach($dimensions as $d=>$label) + + @endforeach diff --git a/resources/views/fluidbook_publication/link_editor_icons.blade.php b/resources/views/fluidbook_publication/link_editor_icons.blade.php index 8f5c77a41..643ee648f 100644 --- a/resources/views/fluidbook_publication/link_editor_icons.blade.php +++ b/resources/views/fluidbook_publication/link_editor_icons.blade.php @@ -1,5 +1,5 @@ {{-- __('!! Editeur de liens') --}} - + @push('linkeditor_scripts')