Commit 6dd1dff3 authored by SergeyLuzyanin's avatar SergeyLuzyanin

move drawing locks to base class

parent 7901e4ab
...@@ -564,13 +564,18 @@ function FrozenPlace(ws, type) { ...@@ -564,13 +564,18 @@ function FrozenPlace(ws, type) {
object.graphicObject.draw(canvas.shapeCtx); object.graphicObject.draw(canvas.shapeCtx);
// Lock // Lock
if ( (object.graphicObject.lockType != undefined) && (object.graphicObject.lockType != AscCommon.c_oAscLockTypes.kLockTypeNone) ) { 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.SetIntegerGrid(false);
canvas.shapeCtx.transform3(object.graphicObject.transform, false); canvas.shapeCtx.transform3(object.graphicObject.transform, false);
canvas.shapeCtx.DrawLockObjectRect(object.graphicObject.lockType, 0, 0, object.graphicObject.extX, object.graphicObject.extY ); canvas.shapeCtx.DrawLockObjectRect(object.graphicObject.lockType, 0, 0, object.graphicObject.extX, object.graphicObject.extY );
canvas.shapeCtx.reset(); canvas.shapeCtx.reset();
canvas.shapeCtx.SetIntegerGrid(true); canvas.shapeCtx.SetIntegerGrid(true);
} }
}
}
_this.restore(canvas.shapeCtx); _this.restore(canvas.shapeCtx);
}; };
......
...@@ -10851,31 +10851,9 @@ CChartSpace.prototype.draw = function(graphics) ...@@ -10851,31 +10851,9 @@ CChartSpace.prototype.draw = function(graphics)
} }
} }
graphics.RestoreGrState(); graphics.RestoreGrState();
if(!this.group) if(this.drawLocks(this.transform, graphics)){
{
var oLock;
if(this.parent instanceof ParaDrawing)
{
oLock = this.parent.Lock;
}
else if(this.Lock)
{
oLock = this.Lock;
}
if(oLock && AscCommon.locktype_None != oLock.Get_Type())
{
graphics.SaveGrState();
var bCoMarksDraw = true;
if(typeof editor !== "undefined" && editor && AscFormat.isRealBool(editor.isCoMarksDraw)){
bCoMarksDraw = editor.isCoMarksDraw;
}
if(bCoMarksDraw){
graphics.transform3(this.transform);
graphics.DrawLockObjectRect(oLock.Get_Type(), 0, 0, this.extX, this.extY);
}
graphics.RestoreGrState(); graphics.RestoreGrState();
} }
}
}; };
CChartSpace.prototype.addToSetPosition = function(dLbl) CChartSpace.prototype.addToSetPosition = function(dLbl)
......
...@@ -816,13 +816,11 @@ CGraphicFrame.prototype.draw = function(graphics) ...@@ -816,13 +816,11 @@ CGraphicFrame.prototype.draw = function(graphics)
} }
if(this.graphicObject) if(this.graphicObject)
{ {
graphics.transform3(this.transform); graphics.transform3(this.transform);
graphics.SetIntegerGrid(true); graphics.SetIntegerGrid(true);
this.graphicObject.Draw(0, graphics); this.graphicObject.Draw(0, graphics);
if(AscCommon.locktype_None != this.Lock.Get_Type() && !this.group) this.drawLocks(this.transform, graphics);
graphics.DrawLockObjectRect(this.Lock.Get_Type() , 0, 0, this.extX, this.extY);
graphics.reset();
graphics.SetIntegerGrid(true);
} }
}; };
......
...@@ -1042,6 +1042,50 @@ ...@@ -1042,6 +1042,50 @@
} }
}; };
CGraphicObjectBase.prototype.drawLocks = function(transform, graphics){
var bNotes = !!(this.parent && this.parent.kind === AscFormat.TYPE_KIND.NOTES);
if(!this.group && !bNotes)
{
var oLock;
if(this.parent instanceof ParaDrawing)
{
oLock = this.parent.Lock;
}
else if(this.Lock)
{
oLock = this.Lock;
}
if(oLock && AscCommon.locktype_None !== oLock.Get_Type())
{
var bCoMarksDraw = true;
var oApi = editor || Asc['editor'];
if(oApi){
switch(oApi.getEditorId()){
case AscCommon.c_oEditorId.Word:{
bCoMarksDraw = (true === oApi.isCoMarksDraw || AscCommon.locktype_Mine !== oLock.Get_Type());
break;
}
case AscCommon.c_oEditorId.Presentation:{
bCoMarksDraw = (!AscCommon.CollaborativeEditing.Is_Fast() || AscCommon.locktype_Mine !== oLock.Get_Type());
break;
}
case AscCommon.c_oEditorId.Spreadsheet:{
bCoMarksDraw = (!oApi.collaborativeEditing.getFast() || AscCommon.locktype_Mine !== oLock.Get_Type());
break;
}
}
}
if(bCoMarksDraw){
graphics.transform3(transform);
graphics.DrawLockObjectRect(oLock.Get_Type(), 0, 0, this.extX, this.extY);
return true;
}
}
}
return false;
};
window['AscFormat'] = window['AscFormat'] || {}; window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CGraphicObjectBase = CGraphicObjectBase; window['AscFormat'].CGraphicObjectBase = CGraphicObjectBase;
window['AscFormat'].CGraphicBounds = CGraphicBounds; window['AscFormat'].CGraphicBounds = CGraphicBounds;
......
...@@ -410,29 +410,7 @@ function CGroupShape() ...@@ -410,29 +410,7 @@ function CGroupShape()
this.spTree[i].draw(graphics); this.spTree[i].draw(graphics);
if(!this.group) this.drawLocks(this.transform, graphics);
{
var oLock;
if(this.parent instanceof ParaDrawing)
{
oLock = this.parent.Lock;
}
else if(this.Lock)
{
oLock = this.Lock;
}
if(oLock && AscCommon.locktype_None != oLock.Get_Type())
{
var bCoMarksDraw = true;
if(typeof editor !== "undefined" && editor && AscFormat.isRealBool(editor.isCoMarksDraw)){
bCoMarksDraw = editor.isCoMarksDraw;
}
if(bCoMarksDraw){
graphics.transform3(this.transform);
graphics.DrawLockObjectRect(oLock.Get_Type(), 0, 0, this.extX, this.extY);
}
}
}
graphics.reset(); graphics.reset();
graphics.SetIntegerGrid(true); graphics.SetIntegerGrid(true);
}; };
......
...@@ -643,29 +643,7 @@ CImageShape.prototype.draw = function(graphics, transform) ...@@ -643,29 +643,7 @@ CImageShape.prototype.draw = function(graphics, transform)
this.brush = oldBrush; this.brush = oldBrush;
this.pen = oldPen; this.pen = oldPen;
if(!this.group) this.drawLocks(_transform, graphics);
{
var oLock;
if(this.parent instanceof ParaDrawing)
{
oLock = this.parent.Lock;
}
else if(this.Lock)
{
oLock = this.Lock;
}
if(oLock && AscCommon.locktype_None != oLock.Get_Type())
{
var bCoMarksDraw = true;
if(typeof editor !== "undefined" && editor && AscFormat.isRealBool(editor.isCoMarksDraw)){
bCoMarksDraw = editor.isCoMarksDraw;
}
if(bCoMarksDraw){
graphics.transform3(_transform);
graphics.DrawLockObjectRect(oLock.Get_Type(), 0, 0, this.extX, this.extY);
}
}
}
graphics.reset(); graphics.reset();
graphics.SetIntegerGrid(true); graphics.SetIntegerGrid(true);
}; };
......
...@@ -4358,31 +4358,7 @@ CShape.prototype.draw = function (graphics, transform, transformText, pageIndex) ...@@ -4358,31 +4358,7 @@ CShape.prototype.draw = function (graphics, transform, transformText, pageIndex)
} }
} }
} }
this.drawLocks && this.drawLocks(_transform, graphics);
var bNotes = !!(this.parent && this.parent.kind === AscFormat.TYPE_KIND.NOTES);
if(!this.group && !bNotes)
{
var oLock;
if(this.parent instanceof ParaDrawing)
{
oLock = this.parent.Lock;
}
else if(this.Lock)
{
oLock = this.Lock;
}
if(oLock && AscCommon.locktype_None != oLock.Get_Type())
{
var bCoMarksDraw = true;
if(typeof editor !== "undefined" && editor && AscFormat.isRealBool(editor.isCoMarksDraw)){
bCoMarksDraw = editor.isCoMarksDraw;
}
if(bCoMarksDraw){
graphics.transform3(_transform);
graphics.DrawLockObjectRect(oLock.Get_Type(), 0, 0, this.extX, this.extY);
}
}
}
graphics.SetIntegerGrid(true); graphics.SetIntegerGrid(true);
graphics.reset(); graphics.reset();
}; };
......
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