diff --git a/browser/src/control/Parts.js b/browser/src/control/Parts.js index 54bde870e..5e55e2e3a 100644 --- a/browser/src/control/Parts.js +++ b/browser/src/control/Parts.js @@ -78,7 +78,7 @@ L.Map.include({ this.fire('scrolltopart'); docLayer._selectedParts.push(docLayer._selectedPart); - if (docLayer.isCursorVisible()) { + if (app.file.textCursor.visible) { // a click outside the slide to clear any selection app.socket.sendMessage('resetselection'); } diff --git a/browser/src/layer/tile/CalcTileLayer.js b/browser/src/layer/tile/CalcTileLayer.js index 381854674..a21570b03 100644 --- a/browser/src/layer/tile/CalcTileLayer.js +++ b/browser/src/layer/tile/CalcTileLayer.js @@ -80,7 +80,7 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({ L.CanvasTileLayer.prototype.onAdd.call(this, map); map.on('resize', function () { - if (this.isCursorVisible()) { + if (app.file.textCursor.visible) { this._onUpdateCursor(true /* scroll */); } }.bind(this)); diff --git a/browser/src/layer/tile/CanvasTileLayer.js b/browser/src/layer/tile/CanvasTileLayer.js index bab602c39..4f1857840 100644 --- a/browser/src/layer/tile/CanvasTileLayer.js +++ b/browser/src/layer/tile/CanvasTileLayer.js @@ -2852,7 +2852,7 @@ L.CanvasTileLayer = L.Layer.extend({ var rectArray = this._getTextSelectionRectangles(textMsg); var inTextSearch = $('input#search-input').is(':focus'); - var isTextSelection = this.isCursorVisible() || inTextSearch; + var isTextSelection = app.file.textCursor.visible || inTextSearch; if (rectArray.length) { var rectangles = rectArray.map(function (rect) { @@ -3556,7 +3556,7 @@ L.CanvasTileLayer = L.Layer.extend({ this.eachView(this._viewCursors, function (item) { var viewCursorMarker = item.marker; if (viewCursorMarker) { - viewCursorMarker.setOpacity(this.isCursorVisible() && this._cursorMarker.getPosition().equals(viewCursorMarker.getPosition()) ? 0 : 1); + viewCursorMarker.setOpacity(app.file.textCursor.visible && this._cursorMarker.getPosition().equals(viewCursorMarker.getPosition()) ? 0 : 1); } }, this, true); }, @@ -3663,7 +3663,7 @@ L.CanvasTileLayer = L.Layer.extend({ else { viewCursorMarker.setPositionSize(viewCursorPos, pixBounds.getSize()); } - viewCursorMarker.setOpacity(this.isCursorVisible() && this._cursorMarker.getPosition().equals(viewCursorMarker.getPosition()) ? 0 : 1); + viewCursorMarker.setOpacity(app.file.textCursor.visible && this._cursorMarker.getPosition().equals(viewCursorMarker.getPosition()) ? 0 : 1); if (!viewCursorMarker.isDomAttached()) viewCursorMarker.add(); } @@ -3687,10 +3687,6 @@ L.CanvasTileLayer = L.Layer.extend({ this.eachView(this._graphicViewMarkers, this._onUpdateGraphicViewSelection, this, false); }, - isCursorVisible: function() { - return this._cursorMarker ? this._cursorMarker.isDomAttached() : false; - }, - goToViewCursor: function(viewId) { if (viewId === this._viewId) { this._onUpdateCursor(); @@ -4008,7 +4004,7 @@ L.CanvasTileLayer = L.Layer.extend({ // Hide the keyboard on graphic selection, unless cursor is visible. // Don't interrupt editing in dialogs if (!this._isAnyInputFocused()) - this._map.focus(this.isCursorVisible()); + this._map.focus(app.file.textCursor.visible); if (this._graphicMarker) { this._graphicMarker.removeEventParent(this._map); @@ -5052,7 +5048,7 @@ L.CanvasTileLayer = L.Layer.extend({ this._pinchStartCenter = this._map.project(pinchStartCenter).multiplyBy(app.dpiScale); // in core pixels this._painter._offset = new L.Point(0, 0); - if (this.isCursorVisible()) { + if (app.file.textCursor.visible) { this._cursorMarker.setOpacity(0); } if (this._map._textInput._cursorHandler) { @@ -5080,7 +5076,7 @@ L.CanvasTileLayer = L.Layer.extend({ }, postZoomAnimation: function () { - if (this.isCursorVisible()) { + if (app.file.textCursor.visible) { this._cursorMarker.setOpacity(1); } if (this._map._textInput._cursorHandler) { diff --git a/browser/src/map/Map.js b/browser/src/map/Map.js index d0be0c12a..6ce989fb0 100644 --- a/browser/src/map/Map.js +++ b/browser/src/map/Map.js @@ -519,7 +519,7 @@ L.Map = L.Evented.extend({ if (app.file.textCursor.visible) cursorInBounds = app.file.viewedRectangle.containsPoint([app.file.textCursor.rectangle.x1, app.file.textCursor.rectangle.y1]); - var cursorActive = calcLayer.isCursorVisible(); + var cursorActive = app.file.textCursor.visible; if (cursorActive && cursorInBounds) { var cursorCenter = new L.Point(app.file.textCursor.rectangle.center[0], app.file.textCursor.rectangle.center[1]); var newCursorCenter = sheetGeom.getTileTwipsAtZoom(cursorCenter, zoomScaleAbs); @@ -596,7 +596,7 @@ L.Map = L.Evented.extend({ return; this._ignoreCursorUpdate = !enable; - if (!docLayer.isCursorVisible()) + if (!app.file.textCursor.visible) return; if (!enable) { diff --git a/browser/src/map/handler/Map.TouchGesture.js b/browser/src/map/handler/Map.TouchGesture.js index 62c53f69b..6c559bb77 100644 --- a/browser/src/map/handler/Map.TouchGesture.js +++ b/browser/src/map/handler/Map.TouchGesture.js @@ -375,7 +375,7 @@ L.Map.TouchGesture = L.Handler.extend({ if (docLayer) { if (docLayer.hasGraphicSelection()) { // Need keyboard when cursor is visible. - acceptInput = this._map._docLayer.isCursorVisible(); + acceptInput = app.file.textCursor.visible; } else if (docLayer._docType === 'text') { acceptInput = true; // Always show the keyboard in Writer on tap. } else if (docLayer._docType === 'spreadsheet') { @@ -427,7 +427,7 @@ L.Map.TouchGesture = L.Handler.extend({ } // Show keyboard when no graphic selection, or cursor is visible. - var acceptInput = !docLayer.hasGraphicSelection() || docLayer.isCursorVisible(); + var acceptInput = !docLayer.hasGraphicSelection() || app.file.textCursor.visible; if (navigator.platform === 'iPhone' && docLayer._docType === 'presentation') acceptInput = true;