cypress_test/integration_tests/common/calc_helper.js |    2 -
 loleaflet/css/spreadsheet.css                        |    2 -
 loleaflet/src/layer/tile/TileLayer.js                |   28 ++++++++++++++-----
 3 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit d12cc35045c480311f019afec3a3a1771eb65aa0
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Thu Jul 9 11:25:25 2020 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Jul 9 13:15:29 2020 +0200

    Make cell markers less heavy on desktop
    
    * Don't show selection resize markers for single cell
      selection on desktop
    * Use smaller autofill marker on desktop, for single cell
      show it in the corner like in the core
    
    Change-Id: Ic36c16213532ec8b615ee808f836b939f35245fd
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98420
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/cypress_test/integration_tests/common/calc_helper.js 
b/cypress_test/integration_tests/common/calc_helper.js
index 3fc8a996f..8542f7c3a 100644
--- a/cypress_test/integration_tests/common/calc_helper.js
+++ b/cypress_test/integration_tests/common/calc_helper.js
@@ -44,7 +44,7 @@ function clickOnFirstCell(firstClick = true, dblClick = 
false) {
                });
 
        if (firstClick && !dblClick)
-               cy.get('.spreadsheet-cell-resize-marker')
+               cy.get('.spreadsheet-cell-autofill-marker')
                        .should('be.visible');
        else
                cy.get('.leaflet-cursor.blinking-cursor')
diff --git a/loleaflet/css/spreadsheet.css b/loleaflet/css/spreadsheet.css
index a24792192..651dfb97b 100644
--- a/loleaflet/css/spreadsheet.css
+++ b/loleaflet/css/spreadsheet.css
@@ -217,8 +217,6 @@
 .spreadsheet-cell-autofill-marker {
        margin-left: 0px;
        margin-top: 0px;
-       width: 16px;
-       height: 16px;
        background-image: url('images/cell-autofill-marker.svg');
        background-size: 100% 100%;
        background-repeat: no-repeat;
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 438476c26..92257f195 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -178,7 +178,7 @@ L.TileLayer = L.GridLayer.extend({
                this._cellAutofillMarker = L.marker(new L.LatLng(0, 0), {
                        icon: L.divIcon({
                                className: 'spreadsheet-cell-autofill-marker',
-                               iconSize: null
+                               iconSize: window.mode.isDesktop() ? [8, 8] : 
[16, 16]
                        }),
                        draggable: true
                });
@@ -3079,7 +3079,12 @@ L.TileLayer = L.GridLayer.extend({
        },
 
        _onUpdateCellResizeMarkers: function () {
-               if (this._selections.getLayers().length !== 0 || 
(this._cellCursor && !this._isEmptyRectangle(this._cellCursor))) {
+               var singleCellOnDesktop = window.mode.isDesktop()
+                                                                       && 
!this._cellSelectionArea
+                                                                       && 
(this._cellCursor && !this._isEmptyRectangle(this._cellCursor));
+
+               if (!singleCellOnDesktop &&
+                       (this._selections.getLayers().length !== 0 || 
(this._cellCursor && !this._isEmptyRectangle(this._cellCursor)))) {
                        if (this._isEmptyRectangle(this._cellSelectionArea) && 
this._isEmptyRectangle(this._cellCursor)) {
                                return;
                        }
@@ -3107,10 +3112,6 @@ L.TileLayer = L.GridLayer.extend({
                                        
this._map.addLayer(this._cellAutofillMarker);
                                        var cellAutoFillMarkerPoisition = 
cellRectangle.getCenter();
                                        cellAutoFillMarkerPoisition.lat = 
cellRectangle.getSouth();
-                                       cellAutoFillMarkerPoisition = 
this._map.project(cellAutoFillMarkerPoisition);
-                                       var sizeAutoFill = 
this._cellAutofillMarker._icon.getBoundingClientRect();
-                                       cellAutoFillMarkerPoisition = 
cellAutoFillMarkerPoisition.subtract(new L.Point(sizeAutoFill.width / 2, 
sizeAutoFill.height / 2));
-                                       cellAutoFillMarkerPoisition = 
this._map.unproject(cellAutoFillMarkerPoisition);
                                        
this._cellAutofillMarker.setLatLng(cellAutoFillMarkerPoisition);
                                }
                                else if (this._cellAutofillMarker) {
@@ -3118,7 +3119,20 @@ L.TileLayer = L.GridLayer.extend({
                                }
                        }
                }
-               else {
+               else if (singleCellOnDesktop) {
+                       cellRectangle = this._cellSelectionArea ? 
this._cellSelectionArea : this._cellCursor;
+
+                       if (this._cellAutoFillArea) {
+                               if (!this._cellAutofillMarker.isDragged) {
+                                       
this._map.addLayer(this._cellAutofillMarker);
+                                       cellAutoFillMarkerPoisition = 
L.latLng(cellRectangle.getSouth(), cellRectangle.getEast());
+                                       
this._cellAutofillMarker.setLatLng(cellAutoFillMarkerPoisition);
+                               }
+                       }
+
+                       this._map.removeLayer(this._cellResizeMarkerStart);
+                       this._map.removeLayer(this._cellResizeMarkerEnd);
+               } else {
                        this._map.removeLayer(this._cellResizeMarkerStart);
                        this._map.removeLayer(this._cellResizeMarkerEnd);
                        this._map.removeLayer(this._cellAutofillMarker);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to