From: Vincent Vanwaelscappel Date: Mon, 8 Sep 2025 14:40:15 +0000 (+0200) Subject: wait #7467 @4 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=da5e0c298ebe20803d7a7d3d0b52e5e492926fe5;p=fluidbook-toolbox.git wait #7467 @4 --- diff --git a/resources/linkeditor-stable/js/linkeditor.accessibility.js b/resources/linkeditor-stable/js/linkeditor.accessibility.js index a5beef42c..ad01a7818 100644 --- a/resources/linkeditor-stable/js/linkeditor.accessibility.js +++ b/resources/linkeditor-stable/js/linkeditor.accessibility.js @@ -2,6 +2,8 @@ import Sortable from 'sortablejs'; function LinkeditorAccessibility(linkeditor) { this.linkeditor = linkeditor; + this.interactiveThreshold = 6; + this.nonInteractiveTypes = [14, 15, 39]; } LinkeditorAccessibility.prototype = { @@ -63,7 +65,6 @@ LinkeditorAccessibility.prototype = { moveSelectionOrder: function (way) { let start; let selection = this.getCurrentOrderableSelection(); - console.log(selection); let num = selection.length; if (num <= 0) { return; @@ -112,17 +113,39 @@ LinkeditorAccessibility.prototype = { filterOrderableLinks: function (links) { + let $this = this; let res = []; $.each(links, function () { - if ($(this).attr('fb-calc-depth') < 50) { - return; + if ($this.isInteractive(this)) { + res.push(this); } - res.push(this); }); return this.orderLinks(res); }, + isInteractive: function (link) { + link = $(link); + if (link.attr('fb-calc-depth') < this.interactiveThreshold * 10) { + return false; + } + if (this.nonInteractiveTypes.indexOf(parseInt(link.attr('fb-type'))) > -1) { + return false; + } + let x = parseFloat(link.attr('fb-left')); + let y = parseFloat(link.attr('fb-top')); + let w = parseFloat(link.attr('fb-width')); + let h = parseFloat(link.attr('fb-height')); + if (x > this.linkeditor.fw || y > this.linkeditor.fh) { + return false; + } + if (x + w < 0 || y + h < 0) { + return false; + } + return true; + + }, + orderLinks: function (links) { let arr = links; if (links instanceof jQuery) { @@ -219,8 +242,11 @@ LinkeditorAccessibility.prototype = { let $this = this; let links = []; $('#linkeditor-links .link:not(.pendingCreate)').each(function () { - let level = $this.getLinkLevel($(this)); - links.push({link: $(this), interactive: level >= 5, order: parseFloat($(this).attr('fb-order'),)}); + links.push({ + link: $(this), + interactive: $this.isInteractive($(this)), + order: parseFloat($(this).attr('fb-order'),) + }); }); links.sort(function (a, b) { @@ -248,7 +274,7 @@ LinkeditorAccessibility.prototype = { getLinkLevel: function (link) { let d = parseInt($(link).attr('fb-calc-depth')); var m = 1; - if (d >= 30 && d < 50) { + if (d >= 30 && d < this.interactiveThreshold * 10) { m = 10; } return Math.floor((m * d) / 10) / m; @@ -271,8 +297,7 @@ LinkeditorAccessibility.prototype = { let type = $(this).attr('fb-type'); let dest = $(this).attr('fb-to'); let uid = $(this).attr('fb-uid'); - let level = $this.getLinkLevel($(this)); - let interactive = level >= 5; + let interactive = $this.isInteractive($(this)); if (dest === '') { dest = '' + TRANSLATIONS.empty + ''; @@ -365,8 +390,8 @@ LinkeditorAccessibility.prototype = { updateSelection() { this.linkeditor.panels.updatePanelSelection(this); - let l=this.getCurrentOrderableSelection().length; - if(l<1){ + let l = this.getCurrentOrderableSelection().length; + if (l < 1) { $('[data-action="accessibility.moveSelectionOrder"]').addClass('disabled'); } else { $('[data-action="accessibility.moveSelectionOrder"]').removeClass('disabled');