Commit 6dd1dff3 authored by SergeyLuzyanin's avatar SergeyLuzyanin

move drawing locks to base class

parent 7901e4ab
......@@ -564,12 +564,17 @@ function FrozenPlace(ws, type) {
object.graphicObject.draw(canvas.shapeCtx);
// Lock
if ( (object.graphicObject.lockType != undefined) && (object.graphicObject.lockType != AscCommon.c_oAscLockTypes.kLockTypeNone) ) {
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);
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);
......
......@@ -10851,30 +10851,8 @@ CChartSpace.prototype.draw = function(graphics)
}
}
graphics.RestoreGrState();
if(!this.group)
{
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();
}
if(this.drawLocks(this.transform, graphics)){
graphics.RestoreGrState();
}
};
......
......@@ -816,13 +816,11 @@ CGraphicFrame.prototype.draw = function(graphics)
}
if(this.graphicObject)
{
graphics.transform3(this.transform);
graphics.SetIntegerGrid(true);
this.graphicObject.Draw(0, graphics);
if(AscCommon.locktype_None != this.Lock.Get_Type() && !this.group)
graphics.DrawLockObjectRect(this.Lock.Get_Type() , 0, 0, this.extX, this.extY);
graphics.reset();
graphics.SetIntegerGrid(true);
this.drawLocks(this.transform, graphics);
}
};
......
......@@ -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'].CGraphicObjectBase = CGraphicObjectBase;
window['AscFormat'].CGraphicBounds = CGraphicBounds;
......
......@@ -410,29 +410,7 @@ function CGroupShape()
this.spTree[i].draw(graphics);
if(!this.group)
{
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);
}
}
}
this.drawLocks(this.transform, graphics);
graphics.reset();
graphics.SetIntegerGrid(true);
};
......
......@@ -643,29 +643,7 @@ CImageShape.prototype.draw = function(graphics, transform)
this.brush = oldBrush;
this.pen = oldPen;
if(!this.group)
{
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);
}
}
}
this.drawLocks(_transform, graphics);
graphics.reset();
graphics.SetIntegerGrid(true);
};
......
......@@ -4358,31 +4358,7 @@ CShape.prototype.draw = function (graphics, transform, transformText, pageIndex)
}
}
}
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);
}
}
}
this.drawLocks && this.drawLocks(_transform, graphics);
graphics.SetIntegerGrid(true);
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