From 0b849e76b65751144720785e8656f985e01ea90b Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Thu, 17 Oct 2019 12:00:35 +0300 Subject: [PATCH 01/29] Gradient slider (add new color) --- .../main/lib/component/MultiSliderGradient.js | 10 +++++++ apps/common/main/lib/component/Slider.js | 26 ++++++++++++++++--- .../main/app/view/ShapeSettings.js | 5 ++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/component/MultiSliderGradient.js b/apps/common/main/lib/component/MultiSliderGradient.js index 8ad11eaff..5f79042fb 100644 --- a/apps/common/main/lib/component/MultiSliderGradient.js +++ b/apps/common/main/lib/component/MultiSliderGradient.js @@ -159,6 +159,16 @@ define([ me.changeSliderStyle(); }, + addNewThumb: function(index, lastIndex, color) { + var me = this; + me.thumbs[index].thumb.on('dblclick', null, function() { + me.trigger('thumbdblclick', me); + }); + me.thumbs[index].thumbcolor = me.thumbs[index].thumb.find('> div'); + (index>0) && this.setColorValue(this.getColorValue(lastIndex), index); + me.changeSliderStyle(); + }, + removeThumb: function(index) { if (index===undefined) index = this.thumbs.length-1; if (index>0) { diff --git a/apps/common/main/lib/component/Slider.js b/apps/common/main/lib/component/Slider.js index 0ee059b7e..ba49e37cd 100644 --- a/apps/common/main/lib/component/Slider.js +++ b/apps/common/main/lib/component/Slider.js @@ -403,7 +403,26 @@ define([ $(document).on('mousemove', null, e.data, me.binding.onMouseMove); }; - var onTrackMouseDown = function (e) { + var onTrackMouseUp = function (e) { + if ( me.disabled ) return; + + var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))), + lastIndex = findThumb(pos), + thumbColor = me.thumbs[lastIndex].colorValue, + lastValue = me.thumbs[lastIndex].value, + value = pos/me.delta + me.minValue; + me.addThumb(); + var newIndex = me.thumbs.length - 1; + me.setThumbPosition(newIndex, pos); + me.thumbs[newIndex].value = value; + me.trigger('addthumb', me, newIndex, lastIndex, thumbColor); + + me.sortThumbs(); + + me.trigger('change', me); + }; + + /*var onTrackMouseDown = function (e) { if ( me.disabled ) return; var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))), @@ -416,7 +435,7 @@ define([ me.trigger('change', me, value, lastValue); me.trigger('changecomplete', me, value, lastValue); - }; + };*/ var findThumb = function(pos) { var nearest = 100, @@ -462,7 +481,8 @@ define([ me.setActiveThumb(0, true); if (!me.rendered) { - el.on('mousedown', '.track', onTrackMouseDown); + /*el.on('mousedown', '.track', onTrackMouseDown);*/ + el.on('mouseup', '.track', onTrackMouseUp); } me.rendered = true; diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index 2a5281b4a..a3f54b70c 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -1293,6 +1293,11 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, lastIndex, color){ + me.GradColor.currentIdx = index; + + me.sldrGradient.addNewThumb(index, lastIndex, color); + }); this.fillControls.push(this.sldrGradient); this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ From f34167d0f2a8c1c53f35fee56f6f6fa6704b1159 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 18 Oct 2019 13:28:30 +0300 Subject: [PATCH 02/29] Remove comments (current, all, only my comments) --- apps/common/main/lib/controller/Comments.js | 12 ++++- apps/common/main/lib/view/ReviewChanges.js | 52 ++++++++++++++++++++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/controller/Comments.js b/apps/common/main/lib/controller/Comments.js index b8f30b6c4..50348c6ec 100644 --- a/apps/common/main/lib/controller/Comments.js +++ b/apps/common/main/lib/controller/Comments.js @@ -126,6 +126,9 @@ define([ 'comment:closeEditing': _.bind(this.closeEditing, this), 'comment:disableHint': _.bind(this.disableHint, this), 'comment:addDummyComment': _.bind(this.onAddDummyComment, this) + }, + 'Common.Views.ReviewChanges': { + 'comment:removeComments': _.bind(this.onRemoveComments, this) } }); @@ -180,7 +183,7 @@ define([ this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this)); this.api.asc_registerCallback('asc_onRemoveComment', _.bind(this.onApiRemoveComment, this)); this.api.asc_registerCallback('asc_onChangeComments', _.bind(this.onChangeComments, this)); - this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onRemoveComments, this)); + this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onApiRemoveComments, this)); this.api.asc_registerCallback('asc_onChangeCommentData', _.bind(this.onApiChangeCommentData, this)); this.api.asc_registerCallback('asc_onLockComment', _.bind(this.onApiLockComment, this)); this.api.asc_registerCallback('asc_onUnLockComment', _.bind(this.onApiUnLockComment, this)); @@ -233,6 +236,11 @@ define([ this.api.asc_removeComment(id); } }, + onRemoveComments: function (type) { + if (this.api) { + this.api.asc_removeComments(type!='current', type=='my' || !this.mode.canEditComments);// 1 param = true if remove all comments (not current), 2 param - only my comments + } + }, onResolveComment: function (uid) { var t = this, reply = null, @@ -725,7 +733,7 @@ define([ this.updateComments(true); }, - onRemoveComments: function (data) { + onApiRemoveComments: function (data) { for (var i = 0; i < data.length; ++i) { this.onApiRemoveComment(data[i], true); } diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 2325f1b31..f1bef9753 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -64,6 +64,7 @@ define([ '