Commit c2ec1add authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Bug 25882 - [CoEdit] Не рисуются локи вокруг автофигур пока не будут введены данные в ячейки

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57707 954022d7-b5bf-4e40-9824-e11837661b57
parent 819b83d3
......@@ -776,7 +776,6 @@ function DrawingArea(ws) {
if ( !_this.worksheet.objectRender.controller.selectedObjects.length && !api.isStartAddShape )
_this.worksheet._drawSelection();
var chart;
var controller = _this.worksheet.objectRender.controller;
var selected_objects = controller.selection.groupSelection ? controller.selection.groupSelection.selectedObjects : controller.selectedObjects;
......
......@@ -3456,15 +3456,15 @@ function DrawingObjects() {
return response;
};
_this.setGraphicObjectLockState = function(id, state) {
for (var i = 0; i < aObjects.length; i++) {
if ( id == aObjects[i].graphicObject.Id ) {
aObjects[i].graphicObject.lockType = state;
break;
}
}
};
// _this.setGraphicObjectLockState = function(id, state) {
//
// for (var i = 0; i < aObjects.length; i++) {
// if ( id == aObjects[i].graphicObject.Id ) {
// aObjects[i].graphicObject.lockType = state;
// break;
// }
// }
// };
_this.resetLockedGraphicObjects = function() {
......
......@@ -4977,8 +4977,6 @@ DrawingObjectsController.prototype =
}
},
checkSelectedObjectsAndCallback: function(callback, args)
{
var selection_state = this.getSelectionState();
......@@ -4996,31 +4994,13 @@ DrawingObjectsController.prototype =
if(bSync !== true)
{
_this.setSelectionState(selection_state);
for(var i = 0; i < _this.selectedObjects.length; ++i)
{
_this.selectedObjects[i].lockType = c_oAscLockTypes.kLockTypeMine;
}
}
callback.apply(_this, args);
_this.startRecalculate();
// _this.recalculateCurPos();
_this.drawingObjects.sendGraphicObjectProps();
}
};
this.drawingObjects.objectLocker.checkObjects(callback2);
},
checkObjectsAndCallback: function(callback, args)
{
this.drawingObjects.objectLocker.reset();
var objects = this.getDrawingObjects();
for(var i = 0; i < objects.length; ++i)
{
this.drawingObjects.objectLocker.addObjectId(objects[i].Get_Id());
}
var _this = this;
var callback2 = function(bLock)
{
if(bLock)
{
callback.apply(_this, args);
_this.startRecalculate();
_this.recalculateCurPos();
_this.drawingObjects.sendGraphicObjectProps();
}
};
......
......@@ -1509,6 +1509,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
t.collaborativeEditing.addUnlock (lockElem);
}
var drawing;
if (null != lockElem) {
var oldType = lockElem.getType();
if (c_oAscLockTypes.kLockTypeOther2 === oldType || c_oAscLockTypes.kLockTypeOther3 === oldType)
......@@ -1518,8 +1519,18 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Выставляем ID пользователя, залочившего данный элемент
lockElem.setUserId (e["user"]);
if(lockElem && lockElem.Element)
{
drawing = g_oTableId.Get_ById(lockElem.Element["rangeOrObjectId"]);
if(drawing)
{
drawing.lockType = lockElem.Type;
}
}
}
if (t.wb) {
// Шлем update для toolbar-а, т.к. когда select в lock ячейке нужно заблокировать toolbar
t.wb._onWSSelectionChanged(/*info*/null);
......@@ -1534,6 +1545,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
ws.draw();
else
ws.updateSelection();
if(drawing && ws.model === drawing.worksheet)
{
ws.objectRender.showDrawingObjects(true);
}
}
}
};
......@@ -1560,16 +1575,18 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
t.wb.getWorksheet().cleanSelection();
}
var drawing;
if (c_oAscLockTypes.kLockTypeNone !== newType)
lockElem.setType (newType, true);
else {
// Удаляем из lock-ов, тот, кто правил ушел и не сохранил
t.collaborativeEditing.removeUnlock (lockElem);
if ( lockElem.Element["type"] == c_oAscLockTypeElem.Object )
t._onTryResetLockedGraphicObject(lockElem.Element["rangeOrObjectId"]);
drawing = g_oTableId.Get_ById(lockElem.Element["rangeOrObjectId"]);
if(drawing && drawing.lockType !== c_oAscLockTypes.kLockTypeNone)
{
drawing.lockType = c_oAscLockTypes.kLockTypeNone;
}
}
if (t.wb) {
// Шлем update для листов
t._onUpdateSheetsLock(lockElem);
......
......@@ -223,10 +223,12 @@
while (bIsCollaborative && 0 < this.m_arrNeedUnlock2.length) {
oLock = this.m_arrNeedUnlock2.shift();
oLock.setType(c_oAscLockTypes.kLockTypeNone, false);
if (oLock.Element["type"] == c_oAscLockTypeElem.Object) {
if (this.handlers.trigger("tryResetLockedGraphicObject", oLock.Element["rangeOrObjectId"]))
bRedrawGraphicObjects = true;
}
var drawing = g_oTableId.Get_ById(oLock.Element["rangeOrObjectId"]);
if(drawing && drawing.lockType !== c_oAscLockTypes.kLockTypeNone) {
drawing.lockType = c_oAscLockTypes.kLockTypeNone;
bRedrawGraphicObjects = true;
}
this.handlers.trigger("releaseLocks", oLock.Element["guid"]);
}
// Очищаем примененные чужие изменения
......@@ -235,10 +237,11 @@
for (;bIsCollaborative && nIndex < nCount; ++nIndex) {
oLock = this.m_arrNeedUnlock[nIndex];
if (c_oAscLockTypes.kLockTypeOther2 === oLock.getType()) {
if (oLock.Element["type"] == c_oAscLockTypeElem.Object) {
if (this.handlers.trigger("tryResetLockedGraphicObject", oLock.Element["rangeOrObjectId"]))
bRedrawGraphicObjects = true;
}
drawing = g_oTableId.Get_ById(oLock.Element["rangeOrObjectId"]);
if(drawing && drawing.lockType !== c_oAscLockTypes.kLockTypeNone) {
drawing.lockType = c_oAscLockTypes.kLockTypeNone;
bRedrawGraphicObjects = true;
}
this.m_arrNeedUnlock.splice(nIndex, 1);
--nIndex;
--nCount;
......
......@@ -3772,14 +3772,14 @@
arrayCells = this.collaborativeEditing.getLockCellsOther(currentSheetId);
}
if (bIsDrawObjects) {
var arrayObjects = (c_oAscLockTypes.kLockTypeMine === type) ?
this.collaborativeEditing.getLockObjectsMe(currentSheetId) : this.collaborativeEditing.getLockObjectsOther(currentSheetId);
for (i = 0; i < arrayObjects.length; ++i) {
this.objectRender.setGraphicObjectLockState(arrayObjects[i], type);
}
}
///if (bIsDrawObjects) {
/// var arrayObjects = (c_oAscLockTypes.kLockTypeMine === type) ?
/// this.collaborativeEditing.getLockObjectsMe(currentSheetId) : this.collaborativeEditing.getLockObjectsOther(currentSheetId);
///
/// for (i = 0; i < arrayObjects.length; ++i) {
/// this.objectRender.setGraphicObjectLockState(arrayObjects[i], type);
/// }
///}
for (i = 0; i < arrayCells.length; ++i) {
oCellTmp = new asc_Range(arrayCells[i].c1, arrayCells[i].r1, arrayCells[i].c2, arrayCells[i].r2);
......@@ -9379,6 +9379,7 @@
t._cleanCellsTextMetricsCache();
t._prepareCellTextMetricsCache();
t.objectRender.setScrollOffset();
t.objectRender.rebuildChartGraphicObjects(oChangeData);
t.draw();
t.handlers.trigger("reinitializeScroll");
......@@ -9386,8 +9387,6 @@
if (isUpdateCols) { t._updateVisibleColsCount(); }
if (isUpdateRows) { t._updateVisibleRowsCount(); }
t.objectRender.rebuildChartGraphicObjects(oChangeData);
t.objectRender.showDrawingObjects(true);
};
switch (prop) {
......@@ -9781,9 +9780,6 @@
if (isUpdateCols) { t._updateVisibleColsCount(); }
if (isUpdateRows) { t._updateVisibleRowsCount(); }
if (false === lockDraw)
t.objectRender.showDrawingObjects(true);
};
WorksheetView.prototype.expandColsOnScroll = function (isNotActive, updateColsCount, newColsCount) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment