Commit 43530f71 authored by SergeyLuzyanin's avatar SergeyLuzyanin

connectors

parent ffc22f45
This diff is collapsed.
...@@ -1087,7 +1087,7 @@ Geometry.prototype= ...@@ -1087,7 +1087,7 @@ Geometry.prototype=
if(Math.sqrt(dx*dx+dy*dy) < distanse) if(Math.sqrt(dx*dx+dy*dy) < distanse)
{ {
return {ang: this.cnxLst[i].ang, x: this.cnxLst[i].x, y: this.cnxLst[i].y}; return {idx: i, ang: this.cnxLst[i].ang, x: this.cnxLst[i].x, y: this.cnxLst[i].y};
} }
} }
return null; return null;
......
...@@ -5390,6 +5390,7 @@ CShape.prototype.getColumnNumber = function(){ ...@@ -5390,6 +5390,7 @@ CShape.prototype.getColumnNumber = function(){
_ret.x = oTransform.TransformPointX(oConnectorInfo.x, oConnectorInfo.y); _ret.x = oTransform.TransformPointX(oConnectorInfo.x, oConnectorInfo.y);
_ret.y = oTransform.TransformPointY(oConnectorInfo.x, oConnectorInfo.y); _ret.y = oTransform.TransformPointY(oConnectorInfo.x, oConnectorInfo.y);
_ret.bounds.fromOther(this.bounds); _ret.bounds.fromOther(this.bounds);
_ret.idx = oConnectorInfo.idx;
return _ret; return _ret;
}; };
......
...@@ -131,6 +131,10 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -131,6 +131,10 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
this.oShapeDrawConnectors = null; this.oShapeDrawConnectors = null;
this.lastSpPr = null; this.lastSpPr = null;
this.startShape = null;
this.endShape = null;
this.endConnectionInfo = null;
AscFormat.ExecuteNoHistory(function(){ AscFormat.ExecuteNoHistory(function(){
if(slide){ if(slide){
...@@ -144,6 +148,7 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -144,6 +148,7 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
this.startConnectionInfo = oConnector; this.startConnectionInfo = oConnector;
this.startX = oConnector.x; this.startX = oConnector.x;
this.startY = oConnector.y; this.startY = oConnector.y;
this.startShape = aSpTree[i];
break; break;
} }
} }
...@@ -268,6 +273,9 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -268,6 +273,9 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
this.oShapeDrawConnectors = null; this.oShapeDrawConnectors = null;
this.lastSpPr = null; this.lastSpPr = null;
this.endShape = null;
this.endConnectionInfo = null;
if(this.bConnector){ if(this.bConnector){
var aSpTree = slide.cSld.spTree; var aSpTree = slide.cSld.spTree;
var oConnector = null; var oConnector = null;
...@@ -277,6 +285,8 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -277,6 +285,8 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
if(oConnector){ if(oConnector){
oEndConnectionInfo = oConnector; oEndConnectionInfo = oConnector;
this.oShapeDrawConnectors = aSpTree[i]; this.oShapeDrawConnectors = aSpTree[i];
this.endShape = aSpTree[i];
this.endConnectionInfo = oEndConnectionInfo;
break; break;
} }
} }
...@@ -548,22 +558,47 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide, ...@@ -548,22 +558,47 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
this.getShape = function(bFromWord, DrawingDocument, drawingObjects) this.getShape = function(bFromWord, DrawingDocument, drawingObjects)
{ {
var shape = new AscFormat.CShape();
if(drawingObjects)
{
shape.setDrawingObjects(drawingObjects);
}
var _sp_pr; var _sp_pr;
if(this.lastSpPr){ if(this.lastSpPr){
var shape = new AscFormat.CConnectionShape();
if(drawingObjects)
{
shape.setDrawingObjects(drawingObjects);
}
_sp_pr = this.lastSpPr.createDuplicate(); _sp_pr = this.lastSpPr.createDuplicate();
shape.setSpPr(_sp_pr); shape.setSpPr(_sp_pr);
_sp_pr.setParent(shape); _sp_pr.setParent(shape);
var nv_sp_pr = new AscFormat.UniNvPr();
nv_sp_pr.cNvPr.setId(++slide.maxId);
shape.setNvSpPr(nv_sp_pr);
var nvUniSpPr = new AscFormat.CNvUniSpPr();
if(this.startShape && this.startConnectionInfo)
{
nvUniSpPr.stCnxIdx = this.startConnectionInfo.idx;
nvUniSpPr.stCnxId = this.startShape.nvSpPr.cNvPr.id;
}
if(this.endShape && this.endConnectionInfo)
{
nvUniSpPr.endCnxIdx = this.endConnectionInfo.idx;
nvUniSpPr.endCnxId = this.endShape.nvSpPr.cNvPr.id;
}
shape.nvSpPr.setUniSpPr(nvUniSpPr);
} }
else{ else{
var shape = new AscFormat.CShape();
if(drawingObjects)
{
shape.setDrawingObjects(drawingObjects);
}
shape.setSpPr(new AscFormat.CSpPr()); shape.setSpPr(new AscFormat.CSpPr());
shape.spPr.setParent(shape); shape.spPr.setParent(shape);
if(bFromWord) if(bFromWord)
......
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