From 5685e9fcd746b7010717361bf41e7d608ddd0b64 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 23 Oct 2023 13:35:55 +0200 Subject: [PATCH] wait #6061 @0:10 --- resources/linkeditor/js/linkeditor.links.js | 90 +++++++-------------- 1 file changed, 27 insertions(+), 63 deletions(-) diff --git a/resources/linkeditor/js/linkeditor.links.js b/resources/linkeditor/js/linkeditor.links.js index 64c4e8d44..a3eaa2fe0 100644 --- a/resources/linkeditor/js/linkeditor.links.js +++ b/resources/linkeditor/js/linkeditor.links.js @@ -83,16 +83,18 @@ LinkeditorLinks.prototype = { this.key('ctrl+alt+shift+f', function () { $this.fixDriftedLinks(); }); - this.key('ctrl+a', function () { $this.selectAllExceptLocked(); return false; }); - this.key('ctrl+c', function () { $this.copy(); return false; }); + this.key('ctrl+o', function () { + $this.locks.lockSelection(); + return false; + }); this.key('ctrl+x', function () { $this.cut(); return false; @@ -203,12 +205,10 @@ LinkeditorLinks.prototype = { $.contextMenu({ - selector: '#linkeditor-canvas,.link,#linkeditor-panel-layers, #linkeditor-panel-layers label', - events: { + selector: '#linkeditor-canvas,.link,#linkeditor-panel-layers, #linkeditor-panel-layers label', events: { show: function (e) { $this.contextMenuPosition = {x: $this.linkeditor.mx, y: $this.linkeditor.my}; - }, - preShow: function (e) { + }, preShow: function (e) { if ($(e).is('.link:not(.selected)')) { $this.deselectAllLinks(); $this.selectLink(e); @@ -221,8 +221,7 @@ LinkeditorLinks.prototype = { } } }, - }, - build: function ($triggerElement, e) { + }, build: function ($triggerElement, e) { var res = { callback: function () { @@ -235,20 +234,15 @@ LinkeditorLinks.prototype = { res.items = { 'select_all': { - isHtmlName: true, - name: TRANSLATIONS.select_all + ' Ctrl+A', - callback: function () { + isHtmlName: true, name: TRANSLATIONS.select_all + ' Ctrl+A', callback: function () { $this.selectAllExceptLocked(); }, } }; if (hasSelection && !multiple) { res.items = $.extend(res.items, { - 'sep_link': '---------', - 'copy_link_id': { - isHtmlName: true, - name: TRANSLATIONS.copy_link_id, - callback: function () { + 'sep_link': '---------', 'copy_link_id': { + isHtmlName: true, name: TRANSLATIONS.copy_link_id, callback: function () { navigator.clipboard.writeText(selection.attr('fb-uid')); }, } @@ -256,7 +250,8 @@ LinkeditorLinks.prototype = { if (CAN_CONTAIN_LINKS[parseInt($(selection).attr('fb-type'))] !== undefined) { res.items.image_link = { isHtmlName: true, - name: TRANSLATIONS.edit_image_link + ' Ctrl+L', callback: function () { + name: TRANSLATIONS.edit_image_link + ' Ctrl+L', + callback: function () { $this.openImageLink(); } }; @@ -265,9 +260,7 @@ LinkeditorLinks.prototype = { if (hasSelection) { res.items.sep_lock = '---------'; res.items.lock = { - isHtmlName: true, - name: TRANSLATIONS.lock + ' Ctrl+L', - callback: function () { + isHtmlName: true, name: TRANSLATIONS.lock + ' Ctrl+O', callback: function () { $this.locks.lockSelection(); }, }; @@ -276,25 +269,19 @@ LinkeditorLinks.prototype = { res.items.sep_clipboard = '---------'; if (hasSelection) { res.items.copy_to_clipboad = { - isHtmlName: true, - name: TRANSLATIONS.copy + ' Ctrl+C', - callback: function () { + isHtmlName: true, name: TRANSLATIONS.copy + ' Ctrl+C', callback: function () { $this.copy(); }, }; res.items.cut_to_clipboad = { - isHtmlName: true, - name: TRANSLATIONS.cut + ' Ctrl+X', - callback: function () { + isHtmlName: true, name: TRANSLATIONS.cut + ' Ctrl+X', callback: function () { $this.cut(); }, }; } if (hasClipboard) { res.items.paste_here = { - isHtmlName: true, - name: TRANSLATIONS.paste_here, - callback: function () { + isHtmlName: true, name: TRANSLATIONS.paste_here, callback: function () { $this.paste($this.contextMenuPosition); }, }; @@ -309,18 +296,12 @@ LinkeditorLinks.prototype = { } if (hasSelection && !multiple) { res.items = $.extend(res.items, { - 'sep_extends': '---------', - 'cover_1': { - isHtmlName: true, - name: TRANSLATIONS.cover_page_1, - callback: function () { + 'sep_extends': '---------', 'cover_1': { + isHtmlName: true, name: TRANSLATIONS.cover_page_1, callback: function () { $this.coverPage(1, false); }, - }, - 'cover_0': { - isHtmlName: true, - name: TRANSLATIONS.cover_page_0, - callback: function () { + }, 'cover_0': { + isHtmlName: true, name: TRANSLATIONS.cover_page_0, callback: function () { $this.coverPage(0, false); }, }, @@ -328,16 +309,11 @@ LinkeditorLinks.prototype = { if (!$this.linkeditor.single) { res.items = $.extend(res.items, { 'cover_double_1': { - isHtmlName: true, - name: TRANSLATIONS.cover_doublepage_1, - callback: function () { + isHtmlName: true, name: TRANSLATIONS.cover_doublepage_1, callback: function () { $this.coverPage(1, true); }, - }, - 'cover_double_0': { - isHtmlName: true, - name: TRANSLATIONS.cover_doublepage_0, - callback: function () { + }, 'cover_double_0': { + isHtmlName: true, name: TRANSLATIONS.cover_doublepage_0, callback: function () { $this.coverPage(0, true); }, }, @@ -346,8 +322,7 @@ LinkeditorLinks.prototype = { } if (hasSelection) { res.items = $.extend(res.items, { - 'sep0': '---------', - "delete": { + 'sep0': '---------', "delete": { isHtmlName: true, name: (multiple ? TRANSLATIONS.delete_selection : TRANSLATIONS.delete_link) + ' Del', callback: function () { @@ -1233,10 +1208,7 @@ LinkeditorLinks.prototype = { } var link = this.getCurrentSelection().eq(0); var rect = { - x: -margin, - y: -margin, - width: this.linkeditor.fw + margin * 2, - height: this.linkeditor.ph + margin * 2, + x: -margin, y: -margin, width: this.linkeditor.fw + margin * 2, height: this.linkeditor.ph + margin * 2, }; if (!this.linkeditor.single && !double) { if (parseFloat($(link).attr('fb-left')) > this.linkeditor.pw) { @@ -1490,11 +1462,7 @@ LinkeditorLinks.prototype = { $(link).attr('fb-polygon', jsonPolygon); if (updateData) { this.updateLinkData($(link).attr('fb-uid'), { - left: minx, - top: miny, - width: w, - height: h, - polygon: jsonPolygon + left: minx, top: miny, width: w, height: h, polygon: jsonPolygon }); } }, @@ -1515,11 +1483,7 @@ LinkeditorLinks.prototype = { let link = this.getFirstLinkInSelection(); let polygon = this.getOffsetPolygon(link); this.movePolygonPointPos = { - x: this.linkeditor.mx, - y: this.linkeditor.my, - ox: polygon[idx].x, - oy: polygon[idx].y, - index: idx + x: this.linkeditor.mx, y: this.linkeditor.my, ox: polygon[idx].x, oy: polygon[idx].y, index: idx }; this.setDragOrigValues(); }, -- 2.39.5