Commit 6fb2b455 authored by SergeyLuzyanin's avatar SergeyLuzyanin

fix bugs with connector's tracks

parent b124f435
......@@ -558,17 +558,31 @@
var _xfrm = this.spPr.xfrm;
if(oBeginDrawing && oEndDrawing){
_startConnectionParams = oBeginDrawing.getConnectionParams(this.getStCxnIdx(), this.group);
_endConnectionParams = oEndDrawing.getConnectionParams(this.getEndCxnIdx(), this.group);
_startConnectionParams = oBeginDrawing.getConnectionParams(this.getStCxnIdx(), null);
_endConnectionParams = oEndDrawing.getConnectionParams(this.getEndCxnIdx(), null);
_spPr = AscFormat.fCalculateSpPr(_startConnectionParams, _endConnectionParams, this.spPr.geometry.preset, this.pen.w);
_xfrm2 = _spPr.xfrm;
_xfrm.setOffX(_xfrm2.offX);
_xfrm.setOffY(_xfrm2.offY);
_xfrm.setExtX(_xfrm2.extX);
_xfrm.setExtY(_xfrm2.extY);
if(!this.group){
_xfrm.setOffX(_xfrm2.offX);
_xfrm.setOffY(_xfrm2.offY);
_xfrm.setFlipH(_xfrm2.flipH);
_xfrm.setFlipV(_xfrm2.flipV);
_xfrm.setRot(_xfrm2.rot);
}
else{
var _xc = _xfrm2.offX + _xfrm2.extX / 2.0;
var _yc = _xfrm2.offY + _xfrm2.extY / 2.0;
var xc = this.group.invertTransform.TransformPointX(_xc, _yc);
var yc = this.group.invertTransform.TransformPointY(_xc, _yc);
_xfrm.setOffX(xc - _xfrm2.extX / 2.0);
_xfrm.setOffY(yc - _xfrm2.extY / 2.0);
_xfrm.setFlipH(this.group.getFullFlipH() ? !_xfrm2.flipH : _xfrm2.flipH);
_xfrm.setFlipV(this.group.getFullFlipV() ? !_xfrm2.flipV : _xfrm2.flipV);
_xfrm.setRot(AscFormat.normalizeRotate(_xfrm2.rot - this.group.getFullRotate()));
}
this.spPr.setGeometry(_spPr.geometry.createDuplicate());
this.checkDrawingBaseCoords();
this.recalculate();
......@@ -619,10 +633,10 @@
}
else{
if(oBeginDrawing){
_startConnectionParams = oBeginDrawing.getConnectionParams(this.getStCxnIdx(), this.group);
_startConnectionParams = oBeginDrawing.getConnectionParams(this.getStCxnIdx(), null);
}
if(oEndDrawing){
_endConnectionParams = oEndDrawing.getConnectionParams(this.getEndCxnIdx(), this.group);
_endConnectionParams = oEndDrawing.getConnectionParams(this.getEndCxnIdx(), null);
}
var _tx, _ty;
if(_startConnectionParams || _endConnectionParams){
......@@ -639,13 +653,26 @@
}
_spPr = AscFormat.fCalculateSpPr(_startConnectionParams, _endConnectionParams, this.spPr.geometry.preset, this.pen && this.pen.w);
_xfrm2 = _spPr.xfrm;
_xfrm.setOffX(_xfrm2.offX);
_xfrm.setOffY(_xfrm2.offY);
_xfrm.setExtX(_xfrm2.extX);
_xfrm.setExtY(_xfrm2.extY);
if(!this.group){
_xfrm.setOffX(_xfrm2.offX);
_xfrm.setOffY(_xfrm2.offY);
_xfrm.setFlipH(_xfrm2.flipH);
_xfrm.setFlipV(_xfrm2.flipV);
_xfrm.setRot(_xfrm2.rot);
}
else{
var _xc = _xfrm2.offX + _xfrm2.extX / 2.0;
var _yc = _xfrm2.offY + _xfrm2.extY / 2.0;
var xc = this.group.invertTransform.TransformPointX(_xc, _yc);
var yc = this.group.invertTransform.TransformPointY(_xc, _yc);
_xfrm.setOffX(xc - _xfrm2.extX / 2.0);
_xfrm.setOffY(yc - _xfrm2.extY / 2.0);
_xfrm.setFlipH(this.group.getFullFlipH() ? !_xfrm2.flipH : _xfrm2.flipH);
_xfrm.setFlipV(this.group.getFullFlipV() ? !_xfrm2.flipV : _xfrm2.flipV);
_xfrm.setRot(AscFormat.normalizeRotate(_xfrm2.rot - this.group.getFullRotate()));
}
this.spPr.setGeometry(_spPr.geometry.createDuplicate());
this.checkDrawingBaseCoords();
this.recalculate();
......
......@@ -701,9 +701,20 @@ RotateState.prototype =
}
}
var aAllConnectors = drawingObjects.getAllConnectorsByDrawings(oOriginalObjects, [], undefined, true);
var oGroupMaps = {};
for(i = 0; i < aAllConnectors.length; ++i){
if(!oMapOriginalsId[aAllConnectors[i].Get_Id()]){
aAllConnectors[i].calculateTransform(((oThis instanceof MoveInGroupState) || (oThis instanceof MoveState)));
var oGroup = aAllConnectors[i].getMainGroup();
if(oGroup){
}
oGroupMaps[oGroup.Id] = oGroup;
}
}
for(var key in oGroupMaps){
if(oGroupMaps.hasOwnProperty(key)){
oGroupMaps[key].updateCoordinatesAfterInternalResize();
}
}
}
......
......@@ -16,11 +16,11 @@
this.startY = this.originalObject.transform.TransformPointY(0, 0);
if(this.originalObject.group){
var oInvertTransform = this.originalObject.group.invertTransform;
var _stX = oInvertTransform.TransformPointX(this.startX, this.startY);
var _stY = oInvertTransform.TransformPointY(this.startX, this.startY);
this.startX = _stX;
this.startY = _stY;
// var oInvertTransform = this.originalObject.group.invertTransform;
// var _stX = oInvertTransform.TransformPointX(this.startX, this.startY);
// var _stY = oInvertTransform.TransformPointY(this.startX, this.startY);
// this.startX = _stX;
// this.startY = _stY;
}
......@@ -62,19 +62,19 @@
}
_bounds = track_bounds;
_transform = this.beginTrack.overlayObject.TransformMatrix;
if(_group){
_rot = AscFormat.normalizeRotate((this.beginTrack.originalObject.group ? this.beginTrack.originalObject.group.getFullRotate() : 0) + _rot - _group.getFullRotate());
if(_group.getFullFlipH()){
_flipH = !_flipH;
}
if(_group.getFullFlipV()){
_flipV = !_flipV;
}
_bounds = _bounds.copy();
_bounds.transform(_group.invertTransform);
_transform = _transform.CreateDublicate();
AscCommon.global_MatrixTransformer.MultiplyAppend(_transform, _group.invertTransform);
}
//if(_group){
// _rot = AscFormat.normalizeRotate((this.beginTrack.originalObject.group ? this.beginTrack.originalObject.group.getFullRotate() : 0) + _rot - _group.getFullRotate());
// if(_group.getFullFlipH()){
// _flipH = !_flipH;
// }
// if(_group.getFullFlipV()){
// _flipV = !_flipV;
// }
// _bounds = _bounds.copy();
// _bounds.transform(_group.invertTransform);
// _transform = _transform.CreateDublicate();
// AscCommon.global_MatrixTransformer.MultiplyAppend(_transform, _group.invertTransform);
//}
oConnectionObject = this.beginTrack.overlayObject.geometry.cnxLst[oConnectorInfo.stCnxIdx];
g_conn_info = {idx: oConnectorInfo.stCnxIdx, ang: oConnectionObject.ang, x: oConnectionObject.x, y: oConnectionObject.y};
_startConnectionParams = this.originalObject.convertToConnectionParams(_rot, _flipH, _flipV, _transform, _bounds, g_conn_info);
......@@ -95,19 +95,19 @@
}
_bounds = track_bounds;
_transform = this.endTrack.overlayObject.TransformMatrix;
if(_group){
_rot = AscFormat.normalizeRotate((this.endTrack.originalObject.group ? this.endTrack.originalObject.group.getFullRotate() : 0) + _rot - _group.getFullRotate());
if(_group.getFullFlipH()){
_flipH = !_flipH;
}
if(_group.getFullFlipV()){
_flipV = !_flipV;
}
_bounds = _bounds.copy();
_bounds.transform(_group.invertTransform);
_transform = _transform.CreateDublicate();
AscCommon.global_MatrixTransformer.MultiplyAppend(_transform, _group.invertTransform);
}
//if(_group){
// _rot = AscFormat.normalizeRotate((this.endTrack.originalObject.group ? this.endTrack.originalObject.group.getFullRotate() : 0) + _rot - _group.getFullRotate());
// if(_group.getFullFlipH()){
// _flipH = !_flipH;
// }
// if(_group.getFullFlipV()){
// _flipV = !_flipV;
// }
// _bounds = _bounds.copy();
// _bounds.transform(_group.invertTransform);
// _transform = _transform.CreateDublicate();
// AscCommon.global_MatrixTransformer.MultiplyAppend(_transform, _group.invertTransform);
//}
oConnectionObject = this.endTrack.overlayObject.geometry.cnxLst[oConnectorInfo.endCnxIdx];
g_conn_info = {idx: oConnectorInfo.endCnxIdx, ang: oConnectionObject.ang, x: oConnectionObject.x, y: oConnectionObject.y};
_endConnectionParams = this.originalObject.convertToConnectionParams(_rot, _flipH, _flipV, _transform, _bounds, g_conn_info);
......@@ -116,7 +116,7 @@
if(!_startConnectionParams){
if(this.beginShape && oConnectorInfo.stCnxIdx !== null){
_startConnectionParams = this.beginShape.getConnectionParams(oConnectorInfo.stCnxIdx, _group);
_startConnectionParams = this.beginShape.getConnectionParams(oConnectorInfo.stCnxIdx, null);
}
else{
if((this.endTrack instanceof AscFormat.MoveShapeImageTrack)){
......@@ -148,17 +148,17 @@
if(!_endConnectionParams){
if(this.endShape && oConnectorInfo.endCnxIdx !== null){
_endConnectionParams = this.endShape.getConnectionParams(oConnectorInfo.endCnxIdx, _group);
_endConnectionParams = this.endShape.getConnectionParams(oConnectorInfo.endCnxIdx, null);
}
else{
if((this.beginTrack instanceof AscFormat.MoveShapeImageTrack)){
var _dx,_dy;
if(this.originalObject.group){
var _oCopyMatrix = this.originalObject.group.invertTransform.CreateDublicate();
_oCopyMatrix.tx = 0;
_oCopyMatrix.ty = 0;
_dx = _oCopyMatrix.TransformPointX(this.beginTrack.lastDx, this.beginTrack.lastDy);
_dy = _oCopyMatrix.TransformPointY(this.beginTrack.lastDx, this.beginTrack.lastDy);
// var _oCopyMatrix = this.originalObject.group.invertTransform.CreateDublicate();
// _oCopyMatrix.tx = 0;
// _oCopyMatrix.ty = 0;
_dx = this.beginTrack.lastDx; //_oCopyMatrix.TransformPointX(this.beginTrack.lastDx, this.beginTrack.lastDy);
_dy = this.beginTrack.lastDy; //_oCopyMatrix.TransformPointY(this.beginTrack.lastDx, this.beginTrack.lastDy);
}
else{
_dx = this.beginTrack.lastDx;
......@@ -169,6 +169,27 @@
this.oSpPr.xfrm.offY += _dy;
this.geometry = this.oSpPr.geometry;
this.overlayObject.geometry = this.geometry;
if(!this.originalObject.group){
this.oSpPr.xfrm.setOffX(this.oSpPr.xfrm.offX);
this.oSpPr.xfrm.setOffY(this.oSpPr.xfrm.offY);
this.oSpPr.xfrm.setFlipH(this.oSpPr.xfrm.flipH);
this.oSpPr.xfrm.setFlipV(this.oSpPr.xfrm.flipV);
this.oSpPr.xfrm.setRot(this.oSpPr.xfrm.rot);
}
else{
var _xc = this.oSpPr.xfrm.offX + this.oSpPr.xfrm.extX / 2.0;
var _yc = this.oSpPr.xfrm.offY + this.oSpPr.xfrm.extY / 2.0;
var xc = this.originalObject.group.invertTransform.TransformPointX(_xc, _yc);
var yc = this.originalObject.group.invertTransform.TransformPointY(_xc, _yc);
this.oSpPr.xfrm.setOffX(xc - this.oSpPr.xfrm.extX / 2.0);
this.oSpPr.xfrm.setOffY(yc - this.oSpPr.xfrm.extY / 2.0);
this.oSpPr.xfrm.setFlipH(this.originalObject.group.getFullFlipH() ? !this.oSpPr.xfrm.flipH : this.oSpPr.xfrm.flipH);
this.oSpPr.xfrm.setFlipV(this.originalObject.group.getFullFlipV() ? !this.oSpPr.xfrm.flipV : this.oSpPr.xfrm.flipV);
this.oSpPr.xfrm.setRot(AscFormat.normalizeRotate(this.oSpPr.xfrm.rot - this.originalObject.group.getFullRotate()));
}
this.calculateTransform();
return;
}
......@@ -178,6 +199,26 @@
}
}
this.oSpPr = AscFormat.fCalculateSpPr(_startConnectionParams, _endConnectionParams, this.originalObject.spPr.geometry.preset, this.overlayObject.pen.w);
if(!this.originalObject.group){
this.oSpPr.xfrm.setOffX(this.oSpPr.xfrm.offX);
this.oSpPr.xfrm.setOffY(this.oSpPr.xfrm.offY);
this.oSpPr.xfrm.setFlipH(this.oSpPr.xfrm.flipH);
this.oSpPr.xfrm.setFlipV(this.oSpPr.xfrm.flipV);
this.oSpPr.xfrm.setRot(this.oSpPr.xfrm.rot);
}
else{
var _xc = this.oSpPr.xfrm.offX + this.oSpPr.xfrm.extX / 2.0;
var _yc = this.oSpPr.xfrm.offY + this.oSpPr.xfrm.extY / 2.0;
var xc = this.originalObject.group.invertTransform.TransformPointX(_xc, _yc);
var yc = this.originalObject.group.invertTransform.TransformPointY(_xc, _yc);
this.oSpPr.xfrm.setOffX(xc - this.oSpPr.xfrm.extX / 2.0);
this.oSpPr.xfrm.setOffY(yc - this.oSpPr.xfrm.extY / 2.0);
this.oSpPr.xfrm.setFlipH(this.originalObject.group.getFullFlipH() ? !this.oSpPr.xfrm.flipH : this.oSpPr.xfrm.flipH);
this.oSpPr.xfrm.setFlipV(this.originalObject.group.getFullFlipV() ? !this.oSpPr.xfrm.flipV : this.oSpPr.xfrm.flipV);
this.oSpPr.xfrm.setRot(AscFormat.normalizeRotate(this.oSpPr.xfrm.rot - this.originalObject.group.getFullRotate()));
}
this.geometry = this.oSpPr.geometry;
this.overlayObject.geometry = this.geometry;
this.calculateTransform();
......
......@@ -1258,7 +1258,10 @@ Slide.prototype =
}
}
else{
if(sp.getObjectType() === AscDFH.historyitem_type_GroupShape){
sp.handleUpdateTheme();
sp.checkExtentsByDocContent();
}
}
}
},
......
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