User app.file.textCursor.visible instead of _isCursorVisible.

Duplicate functionality removed.

Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: Id0bc972d20e6974dc2671696830a55dcb35ade7a
This commit is contained in:
Gökay Şatır 2024-05-21 18:56:19 +03:00 committed by Gökay ŞATIR
parent 594b605ab7
commit e5256c265d
5 changed files with 12 additions and 16 deletions

View file

@ -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');
}

View file

@ -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));

View file

@ -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) {

View file

@ -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) {

View file

@ -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;