mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
Draw dropdown last
This commit is contained in:
@ -527,15 +527,17 @@ function FrozenPlace(ws, type) {
|
||||
// этот рестор нужен для восстановления сложных вложенных клипов
|
||||
canvas.m_oContext.restore();
|
||||
};
|
||||
|
||||
_this.drawObject = function(object, oRect) {
|
||||
|
||||
var oUpdateRect = _this.worksheet.rangeToRectAbs(_this.range, 3);
|
||||
_this.getUpdateRect = function (oRect) {
|
||||
let oUpdateRect = _this.worksheet.rangeToRectAbs(_this.range, 3);
|
||||
if(oRect) {
|
||||
oUpdateRect = oUpdateRect.intersection(oRect);
|
||||
if(!oUpdateRect) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return oUpdateRect;
|
||||
}
|
||||
_this._updateGraphicCanvas = function (fCallback, oRect) {
|
||||
var oUpdateRect = _this.getUpdateRect(oRect);
|
||||
if (!oUpdateRect) {
|
||||
return;
|
||||
}
|
||||
var canvas = _this.worksheet.objectRender.getDrawingCanvas();
|
||||
_this.setTransform(canvas.shapeCtx, canvas.shapeOverlayCtx, canvas.autoShapeTrack);
|
||||
@ -555,22 +557,31 @@ function FrozenPlace(ws, type) {
|
||||
|
||||
_this.clip(canvas.shapeCtx, oClipRect);
|
||||
canvas.shapeCtx.updatedRect = oUpdateRect;
|
||||
object.draw(canvas.shapeCtx);
|
||||
fCallback(canvas.shapeCtx);
|
||||
canvas.shapeCtx.updatedRect = null;
|
||||
// Lock
|
||||
if ( (object.graphicObject.lockType !== undefined) && (object.graphicObject.lockType !== AscCommon.c_oAscLockTypes.kLockTypeNone) ) {
|
||||
var oApi = Asc['editor'];
|
||||
if(oApi){
|
||||
if (!oApi.collaborativeEditing.getFast() || object.graphicObject.lockType !== AscCommon.c_oAscLockTypes.kLockTypeMine){
|
||||
canvas.shapeCtx.SetIntegerGrid(false);
|
||||
canvas.shapeCtx.transform3(object.graphicObject.transform, false);
|
||||
canvas.shapeCtx.DrawLockObjectRect(object.graphicObject.lockType, 0, 0, object.graphicObject.extX, object.graphicObject.extY );
|
||||
canvas.shapeCtx.reset();
|
||||
canvas.shapeCtx.SetIntegerGrid(true);
|
||||
_this.restore(canvas.shapeCtx);
|
||||
}
|
||||
_this.drawObject = function(object, oRect) {
|
||||
this._updateGraphicCanvas(function (graphics) {
|
||||
object.draw(graphics);
|
||||
if ( (object.graphicObject.lockType !== undefined) && (object.graphicObject.lockType !== AscCommon.c_oAscLockTypes.kLockTypeNone) ) {
|
||||
var oApi = Asc['editor'];
|
||||
if(oApi){
|
||||
if (!oApi.collaborativeEditing.getFast() || object.graphicObject.lockType !== AscCommon.c_oAscLockTypes.kLockTypeMine){
|
||||
graphics.SetIntegerGrid(false);
|
||||
graphics.transform3(object.graphicObject.transform, false);
|
||||
graphics.DrawLockObjectRect(object.graphicObject.lockType, 0, 0, object.graphicObject.extX, object.graphicObject.extY );
|
||||
graphics.reset();
|
||||
graphics.SetIntegerGrid(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_this.restore(canvas.shapeCtx);
|
||||
}, oRect);
|
||||
};
|
||||
_this.drawDropDown = function(object, oRect) {
|
||||
this._updateGraphicCanvas(function (graphics) {
|
||||
object.drawDropDown(graphics);
|
||||
});
|
||||
};
|
||||
|
||||
_this.updateRange = function(object, oRange) {
|
||||
@ -810,6 +821,11 @@ DrawingArea.prototype.drawObject = function(object, oRect) {
|
||||
}
|
||||
}
|
||||
};
|
||||
DrawingArea.prototype.drawDropDown = function(object, oRect) {
|
||||
for ( var i = 0; i < this.frozenPlaces.length; i++ ) {
|
||||
this.frozenPlaces[i].drawDropDown(object, oRect);
|
||||
}
|
||||
};
|
||||
DrawingArea.prototype.updateRange = function(object, oRange) {
|
||||
for ( var i = 0; i < this.frozenPlaces.length; i++ ) {
|
||||
if ( this.frozenPlaces[i].isObjectInside(object) ) {
|
||||
|
||||
@ -2333,6 +2333,10 @@ CSparklineView.prototype.setMinMaxValAx = function(minVal, maxVal, oSparklineGro
|
||||
for (var nDrawing = 0; nDrawing < aObjects.length; nDrawing++) {
|
||||
_this.drawingArea.drawObject(aObjects[nDrawing], oUpdateRect);
|
||||
}
|
||||
const aDropDowns = _this.controller.dropDowns;
|
||||
for (var nDrawing = 0; nDrawing < aDropDowns.length; nDrawing++) {
|
||||
_this.drawingArea.drawDropDown(aDropDowns[nDrawing], oUpdateRect);
|
||||
}
|
||||
_this.OnUpdateOverlay();
|
||||
_this.controller.updateSelectionState(true);
|
||||
AscCommon.CollaborativeEditing.Update_ForeignCursorsPositions();
|
||||
|
||||
@ -706,6 +706,7 @@
|
||||
|
||||
|
||||
this.lastCursorInfo = null;
|
||||
this.dropDowns = [];
|
||||
}
|
||||
|
||||
function CanStartEditText(oController) {
|
||||
@ -6191,6 +6192,9 @@
|
||||
},
|
||||
|
||||
onMouseWheel: function (deltaX, deltaY) {
|
||||
for (let i = 0; i < this.dropDowns.length; i += 1) {
|
||||
this.dropDowns[i].forceUpdate();
|
||||
}
|
||||
var aSelection = this.getSelectedArray();
|
||||
if (aSelection.length === 1
|
||||
&& aSelection[0].getObjectType() === AscDFH.historyitem_type_SlicerView) {
|
||||
@ -6198,6 +6202,12 @@
|
||||
}
|
||||
return false;
|
||||
},
|
||||
addDropDown: function(oDropDown) {
|
||||
this.dropDowns.push(oDropDown);
|
||||
},
|
||||
resetDropDowns: function() {
|
||||
this.dropDowns.length = 0;
|
||||
},
|
||||
|
||||
/*onKeyPress: function(e)
|
||||
{
|
||||
|
||||
@ -336,6 +336,12 @@ function getFlatPenColor() {
|
||||
return true;
|
||||
}
|
||||
CControl.prototype.draw = function (graphics, transform, transformText, pageIndex, opt) {
|
||||
const oUR = graphics.updatedRect;
|
||||
if (oUR && this.bounds) {
|
||||
if (!oUR.isIntersectOther(this.bounds)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.controller.draw(graphics, transform, transformText, pageIndex, opt);
|
||||
};
|
||||
CControl.prototype.hitInInnerArea = function (x, y) {
|
||||
@ -353,17 +359,17 @@ function getFlatPenColor() {
|
||||
}
|
||||
CControl.prototype.onMouseDown = function (e, nX, nY, nPageIndex, oDrawingController) {
|
||||
const bRet = this.controller.onMouseDown(e, nX, nY, nPageIndex, oDrawingController);
|
||||
this.controller.updateControl();
|
||||
this.controller.update();
|
||||
return bRet;
|
||||
}
|
||||
CControl.prototype.onMouseMove = function (e, nX, nY, nPageIndex, oDrawingController) {
|
||||
const bRet = this.controller.onMouseMove(e, nX, nY, nPageIndex, oDrawingController);
|
||||
this.controller.updateControl();
|
||||
this.controller.update();
|
||||
return bRet;
|
||||
}
|
||||
CControl.prototype.onMouseUp = function (e, nX, nY, nPageIndex, oDrawingController) {
|
||||
const bRet = this.controller.onMouseUp(e, nX, nY, nPageIndex, oDrawingController);
|
||||
this.controller.updateControl();
|
||||
this.controller.update();
|
||||
return bRet;
|
||||
}
|
||||
CControl.prototype.getCursorInfo = function (e, nX, nY) {
|
||||
@ -571,14 +577,15 @@ function getFlatPenColor() {
|
||||
CControlControllerBase.prototype.checkNeedUpdate = function() {
|
||||
this.isNeedUpdate = true;
|
||||
};
|
||||
CControlControllerBase.prototype.updateControl = function() {
|
||||
CControlControllerBase.prototype.update = function() {
|
||||
if (this.isNeedUpdate) {
|
||||
this.isNeedUpdate = false;
|
||||
this.control.onUpdate();
|
||||
this.forceUpdate();
|
||||
}
|
||||
};
|
||||
CControlControllerBase.prototype.isNeedWriteShape = function() {
|
||||
return false;
|
||||
CControlControllerBase.prototype.forceUpdate = function() {
|
||||
this.control.onUpdate();
|
||||
};
|
||||
|
||||
const CHECKBOX_SIDE_SIZE = 3;
|
||||
@ -2384,7 +2391,7 @@ function getFlatPenColor() {
|
||||
oThis.selectedText = oThis.listBox.listItems[nIndex].text;
|
||||
oThis.updateLinkedCell();
|
||||
oThis.updateSelectionInFormControl();
|
||||
oThis.closeDropdown();
|
||||
oThis.closeDropdown(oDrawingController);
|
||||
}, [], undefined, AscDFH.historydescription_Spreadsheet_SelectListBox, [], true);
|
||||
};
|
||||
};
|
||||
@ -2421,20 +2428,20 @@ function getFlatPenColor() {
|
||||
}
|
||||
};
|
||||
|
||||
CComboBoxController.prototype.openDropdown = function () {
|
||||
CComboBoxController.prototype.openDropdown = function (oDrawingController) {
|
||||
if (!this.isDropdownOpen) {
|
||||
this.isDropdownOpen = true;
|
||||
this.dropButton.setIsHold(true);
|
||||
Asc.editor && Asc.editor.addDropDown(this);
|
||||
oDrawingController.addDropDown(this);
|
||||
this.checkNeedUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
CComboBoxController.prototype.closeDropdown = function () {
|
||||
CComboBoxController.prototype.closeDropdown = function (oDrawingController) {
|
||||
if (this.isDropdownOpen) {
|
||||
this.dropButton.setIsHold(false);
|
||||
this.isDropdownOpen = false;
|
||||
Asc.editor && Asc.editor.resetDropDowns();
|
||||
oDrawingController.resetDropDowns();
|
||||
this.checkNeedUpdate();
|
||||
}
|
||||
};
|
||||
@ -2517,11 +2524,12 @@ function getFlatPenColor() {
|
||||
}
|
||||
|
||||
if (this.isDropdownOpen) {
|
||||
this.listBox.onMouseDown(e, nX, nY, nPageIndex, oDrawingController);
|
||||
this.closeDropdown();
|
||||
if (!this.listBox.onMouseDown(e, nX, nY, nPageIndex, oDrawingController)) {
|
||||
this.closeDropdown(oDrawingController);
|
||||
}
|
||||
return oControl.hit(nX, nY);
|
||||
} else if (oControl.hit(nX, nY)) {
|
||||
this.openDropdown();
|
||||
this.openDropdown(oDrawingController);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user