Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
1cde1b6b
Commit
1cde1b6b
authored
May 12, 2017
by
SergeyLuzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add connector track
parent
0d7affa1
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
376 additions
and
138 deletions
+376
-138
build/configs/webexcel.json
build/configs/webexcel.json
+1
-0
build/configs/webpowerpoint.json
build/configs/webpowerpoint.json
+1
-0
build/configs/webword.json
build/configs/webword.json
+1
-0
common/Drawings/CommonController.js
common/Drawings/CommonController.js
+103
-1
common/Drawings/DrawingObjectsHandlers.js
common/Drawings/DrawingObjectsHandlers.js
+3
-0
common/Drawings/Format/CnxShape.js
common/Drawings/Format/CnxShape.js
+25
-11
common/Drawings/Format/Format.js
common/Drawings/Format/Format.js
+11
-2
common/Drawings/Format/GroupShape.js
common/Drawings/Format/GroupShape.js
+2
-0
common/Drawings/Format/Shape.js
common/Drawings/Format/Shape.js
+1
-1
common/Drawings/TrackObjects/AdjustmentTracks.js
common/Drawings/TrackObjects/AdjustmentTracks.js
+116
-117
common/Drawings/TrackObjects/ConnectorTrack.js
common/Drawings/TrackObjects/ConnectorTrack.js
+109
-0
common/Drawings/TrackObjects/NewShapeTracks.js
common/Drawings/TrackObjects/NewShapeTracks.js
+0
-4
common/Drawings/TrackObjects/RotateTracks.js
common/Drawings/TrackObjects/RotateTracks.js
+2
-2
common/HistoryCommon.js
common/HistoryCommon.js
+1
-0
No files found.
build/configs/webexcel.json
View file @
1cde1b6b
...
...
@@ -75,6 +75,7 @@
"../common/Drawings/TrackObjects/ResizeTracks.js"
,
"../common/Drawings/TrackObjects/RotateTracks.js"
,
"../common/Drawings/TrackObjects/Spline.js"
,
"../common/Drawings/TrackObjects/ConnectorTrack.js"
,
"../common/Drawings/DrawingObjectsHandlers.js"
,
"../common/Drawings/TextDrawer.js"
,
...
...
build/configs/webpowerpoint.json
View file @
1cde1b6b
...
...
@@ -77,6 +77,7 @@
"../common/Drawings/TrackObjects/ResizeTracks.js"
,
"../common/Drawings/TrackObjects/RotateTracks.js"
,
"../common/Drawings/TrackObjects/Spline.js"
,
"../common/Drawings/TrackObjects/ConnectorTrack.js"
,
"../common/Drawings/DrawingObjectsHandlers.js"
,
"../common/Drawings/TextDrawer.js"
,
...
...
build/configs/webword.json
View file @
1cde1b6b
...
...
@@ -77,6 +77,7 @@
"../common/Drawings/TrackObjects/ResizeTracks.js"
,
"../common/Drawings/TrackObjects/RotateTracks.js"
,
"../common/Drawings/TrackObjects/Spline.js"
,
"../common/Drawings/TrackObjects/ConnectorTrack.js"
,
"../common/Drawings/DrawingObjectsHandlers.js"
,
"../common/Drawings/TextDrawer.js"
,
...
...
common/Drawings/CommonController.js
View file @
1cde1b6b
...
...
@@ -143,7 +143,7 @@ var DISTANCE_TO_TEXT_LEFTRIGHT = 3.2;
return
Math
.
abs
(
a
-
b
)
<
fDelta
;
}
return
Math
.
abs
(
a
-
b
)
<
1
e
-
15
;
}
;
}
function
fSolveQuadraticEquation
(
a
,
b
,
c
){
...
...
@@ -719,6 +719,107 @@ DrawingObjectsController.prototype =
},
getAllConnectors
:
function
(
aDrawings
,
allDrawings
){
var
_ret
=
allDrawings
;
if
(
!
_ret
){
_ret
=
[];
}
for
(
var
i
=
0
;
i
<
aDrawings
.
length
;
++
i
){
if
(
aDrawings
[
i
].
getObjectType
()
===
AscDFH
.
historyitem_type_Cnx
){
_ret
.
push
(
aDrawings
[
i
]);
}
else
if
(
aDrawings
[
i
].
getObjectType
()
===
AscDFH
.
historyitem_type_GroupShape
){
aDrawings
[
i
].
getAllConnectors
(
aDrawings
[
i
].
spTree
,
_ret
);
}
}
return
_ret
;
},
getAllShapes
:
function
(
aDrawings
,
allDrawings
){
var
_ret
=
allDrawings
;
if
(
!
_ret
){
_ret
=
[];
}
for
(
var
i
=
0
;
i
<
aDrawings
.
length
;
++
i
){
if
(
aDrawings
[
i
].
getObjectType
()
===
AscDFH
.
historyitem_type_Shape
){
_ret
.
push
(
aDrawings
[
i
]);
}
else
if
(
aDrawings
[
i
].
getObjectType
()
===
AscDFH
.
historyitem_type_GroupShape
){
aDrawings
[
i
].
getAllShapes
(
aDrawings
[
i
].
spTree
,
_ret
);
}
}
return
_ret
;
},
checkConnectorsPreTrack
:
function
(){
if
(
this
.
arrPreTrackObjects
.
length
>
0
&&
this
.
arrPreTrackObjects
[
0
].
originalObject
){
var
aAllConnectors
=
this
.
getAllConnectors
(
this
.
getDrawingArray
());
var
oPreTrack
;
var
stId
=
null
,
endId
=
null
,
oBeginTrack
=
null
,
oEndTrack
=
null
,
oBeginShape
=
null
,
oEndShape
=
null
;
var
aConnectionPreTracks
=
[];
var
aAllShapes
=
null
;
for
(
var
i
=
0
;
i
<
aAllConnectors
.
length
;
++
i
){
stId
=
aAllConnectors
[
i
].
nvSpPr
.
nvUniSpPr
.
stCnxId
;
endId
=
aAllConnectors
[
i
].
nvSpPr
.
nvUniSpPr
.
endCnxId
;
oBeginTrack
=
null
;
oEndTrack
=
null
;
oBeginShape
=
null
;
oEndShape
=
null
;
if
(
stId
!==
null
||
endId
!==
null
){
for
(
var
j
=
0
;
j
<
this
.
arrPreTrackObjects
.
length
;
++
j
){
oPreTrack
=
this
.
arrPreTrackObjects
[
j
].
originalObject
;
if
(
oPreTrack
.
getObjectType
()
===
AscDFH
.
historyitem_type_Shape
&&
oPreTrack
.
nvSpPr
){
if
(
oPreTrack
.
nvSpPr
.
cNvPr
.
id
===
stId
){
oBeginTrack
=
this
.
arrPreTrackObjects
[
j
];
}
if
(
oPreTrack
.
nvSpPr
.
cNvPr
.
id
===
endId
){
oEndTrack
=
this
.
arrPreTrackObjects
[
j
];
}
}
}
}
if
(
oBeginTrack
||
oEndTrack
){
if
(
oBeginTrack
){
oBeginShape
=
oBeginTrack
.
originalObject
;
}
else
{
if
(
stId
!==
null
){
if
(
!
aAllShapes
){
aAllShapes
=
this
.
getAllShapes
(
this
.
getDrawingArray
());
}
for
(
var
j
=
0
;
j
<
aAllShapes
.
length
;
++
j
){
if
(
aAllShapes
[
j
].
nvSpPr
.
cNvPr
.
id
===
stId
){
oBeginShape
=
aAllShapes
[
j
];
}
}
}
}
if
(
oEndTrack
){
oEndShape
=
oEndTrack
.
originalObject
;
}
else
if
(
endId
!==
null
){
if
(
!
aAllShapes
){
aAllShapes
=
this
.
getAllShapes
(
this
.
getDrawingArray
());
}
for
(
var
j
=
0
;
j
<
aAllShapes
.
length
;
++
j
){
if
(
aAllShapes
[
j
].
nvSpPr
.
cNvPr
.
id
===
endId
){
oEndShape
=
aAllShapes
[
j
];
}
}
}
aConnectionPreTracks
.
push
(
new
AscFormat
.
CConnectorTrack
(
aAllConnectors
[
i
],
oBeginTrack
,
oEndTrack
,
oBeginShape
,
oEndShape
));
}
}
for
(
i
=
0
;
i
<
aConnectionPreTracks
.
length
;
++
i
){
this
.
arrPreTrackObjects
.
push
(
aConnectionPreTracks
[
i
]);
}
}
},
//for mobile spreadsheet editor
startEditTextCurrentShape
:
function
()
{
...
...
@@ -6314,6 +6415,7 @@ DrawingObjectsController.prototype =
swapTrackObjects
:
function
()
{
this
.
checkConnectorsPreTrack
();
this
.
clearTrackObjects
();
for
(
var
i
=
0
;
i
<
this
.
arrPreTrackObjects
.
length
;
++
i
)
this
.
addTrackObject
(
this
.
arrPreTrackObjects
[
i
]);
...
...
common/Drawings/DrawingObjectsHandlers.js
View file @
1cde1b6b
...
...
@@ -144,6 +144,7 @@ function handleFloatObjects(drawingObjectsController, drawingArr, e, x, y, group
case
AscDFH
.
historyitem_type_Shape
:
case
AscDFH
.
historyitem_type_ImageShape
:
case
AscDFH
.
historyitem_type_OleObject
:
case
AscDFH
.
historyitem_type_Cnx
:
{
ret
=
handleShapeImage
(
drawing
,
drawingObjectsController
,
e
,
x
,
y
,
group
,
pageIndex
,
bWord
);
if
(
ret
)
...
...
@@ -252,6 +253,7 @@ function handleGroup(drawing, drawingObjectsController, e, x, y, group, pageInde
case
AscDFH
.
historyitem_type_Shape
:
case
AscDFH
.
historyitem_type_ImageShape
:
case
AscDFH
.
historyitem_type_OleObject
:
case
AscDFH
.
historyitem_type_Cnx
:
{
ret
=
handleShapeImageInGroup
(
drawingObjectsController
,
drawing
,
cur_grouped_object
,
e
,
x
,
y
,
pageIndex
,
bWord
);
if
(
ret
)
...
...
@@ -718,6 +720,7 @@ function handleInlineObjects(drawingObjectsController, drawingArr, e, x, y, page
case
AscDFH
.
historyitem_type_Shape
:
case
AscDFH
.
historyitem_type_ImageShape
:
case
AscDFH
.
historyitem_type_OleObject
:
case
AscDFH
.
historyitem_type_Cnx
:
{
ret
=
handleInlineShapeImage
(
drawing
,
drawingObjectsController
,
e
,
x
,
y
,
pageIndex
);
if
(
ret
)
...
...
common/Drawings/Format/CnxShape.js
View file @
1cde1b6b
...
...
@@ -162,7 +162,7 @@
flipH
=
true
;
flipV
=
true
;
oMapAdj
[
"
adj2
"
]
=
100000
-
(
100000
*
(((
_begin
.
bounds
.
r
+
_end
.
bounds
.
l
)
/
2
-
(
xc
-
extY
/
2
))
/
extY
)
+
0.5
)
>>
0
;
oMapAdj
[
"
adj1
"
]
=
(
-
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
;
oMapAdj
[
"
adj1
"
]
=
(
-
100000
*
(
(
_end
.
y
-
(
_end
.
bounds
.
t
-
CONNECTOR_MARGIN
)
)
/
extX
)
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
2
"
;
...
...
@@ -178,16 +178,26 @@
else
{
if
(
_end
.
y
<=
_begin
.
bounds
.
b
){
if
(
_end
.
y
<=
_begin
.
y
){
sPreset
=
"
4
"
;
rot
=
3.0
*
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
extY
=
tmp
;
posX
=
(
_end
.
x
+
_begin
.
x
)
/
2.0
-
extX
/
2.0
;
posY
=
(
_end
.
y
+
_begin
.
y
)
/
2.0
-
extY
/
2.0
;
flipH
=
true
;
oMapAdj
[
"
adj1
"
]
=
-
((
100000
*
((
yc
-
extX
/
2
-
(
Math
.
min
(
_end
.
bounds
.
t
,
_begin
.
bounds
.
t
)
-
CONNECTOR_MARGIN
))
/
extX
)
+
0.5
)
>>
0
);
oMapAdj
[
"
adj2
"
]
=
100000
+
(
100000
*
(
Math
.
max
(
CONNECTOR_MARGIN
,
_end
.
bounds
.
r
+
CONNECTOR_MARGIN
-
_begin
.
x
)
/
extY
)
+
0.5
)
>>
0
;
if
(
_end
.
x
<=
_begin
.
x
){
sPreset
=
"
4
"
;
rot
=
3.0
*
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
extY
=
tmp
;
posX
=
(
_end
.
x
+
_begin
.
x
)
/
2.0
-
extX
/
2.0
;
posY
=
(
_end
.
y
+
_begin
.
y
)
/
2.0
-
extY
/
2.0
;
flipH
=
true
;
oMapAdj
[
"
adj1
"
]
=
-
((
100000
*
((
yc
-
extX
/
2
-
(
Math
.
min
(
_end
.
bounds
.
t
,
_begin
.
bounds
.
t
)
-
CONNECTOR_MARGIN
))
/
extX
)
+
0.5
)
>>
0
);
oMapAdj
[
"
adj2
"
]
=
100000
+
(
100000
*
(
Math
.
max
(
CONNECTOR_MARGIN
,
_end
.
bounds
.
r
+
CONNECTOR_MARGIN
-
_begin
.
x
)
/
extY
)
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
4
"
;
flipV
=
true
;
oMapAdj
[
"
adj1
"
]
=
100000
+
(
100000
*
((
Math
.
max
(
_end
.
bounds
.
r
,
_begin
.
bounds
.
r
)
+
CONNECTOR_MARGIN
-
_end
.
x
)
/
extX
)
+
0.5
)
>>
0
;
oMapAdj
[
"
adj2
"
]
=
100000
+
(
100000
*
(
_end
.
y
-
(
_end
.
bounds
.
t
-
CONNECTOR_MARGIN
))
/
extY
+
0.5
)
>>
0
;
}
}
else
{
sPreset
=
"
4
"
;
...
...
@@ -488,6 +498,10 @@
CConnectionShape
.
prototype
.
calculateSpPr
=
function
(
begin
,
end
){
};
CConnectionShape
.
prototype
.
getObjectType
=
function
(
begin
,
end
){
return
AscDFH
.
historyitem_type_Cnx
;
};
window
[
'
AscFormat
'
]
=
window
[
'
AscFormat
'
]
||
{};
window
[
'
AscFormat
'
].
fCalculateSpPr
=
fCalculateSpPr
;
window
[
'
AscFormat
'
].
fCalculateConnectionInfo
=
fCalculateConnectionInfo
;
...
...
common/Drawings/Format/Format.js
View file @
1cde1b6b
...
...
@@ -4889,8 +4889,17 @@ function CNvUniSpPr()
this
.
stCnxId
=
r
.
GetLong
();
}
else
{
this
.
stCnxIdx
=
r
.
GetLong
();
this
.
stCnxId
=
r
.
GetLong
();
this
.
stCnxIdx
=
null
;
this
.
stCnxId
=
null
;
}
bCnx
=
r
.
GetBool
();
if
(
bCnx
){
this
.
endCnxIdx
=
r
.
GetLong
();
this
.
endCnxId
=
r
.
GetLong
();
}
else
{
this
.
endCnxIdx
=
null
;
this
.
endCnxId
=
null
;
}
};
...
...
common/Drawings/Format/GroupShape.js
View file @
1cde1b6b
...
...
@@ -1672,6 +1672,8 @@ function CGroupShape()
CGroupShape
.
prototype
.
recalculateCurPos
=
AscFormat
.
DrawingObjectsController
.
prototype
.
recalculateCurPos
;
CGroupShape
.
prototype
.
loadDocumentStateAfterLoadChanges
=
AscFormat
.
DrawingObjectsController
.
prototype
.
loadDocumentStateAfterLoadChanges
;
CGroupShape
.
prototype
.
getAllConnectors
=
AscFormat
.
DrawingObjectsController
.
prototype
.
getAllConnectors
;
CGroupShape
.
prototype
.
getAllShapes
=
AscFormat
.
DrawingObjectsController
.
prototype
.
getAllShapes
;
CGroupShape
.
prototype
.
checkDrawingBaseCoords
=
CShape
.
prototype
.
checkDrawingBaseCoords
;
...
...
common/Drawings/Format/Shape.js
View file @
1cde1b6b
...
...
@@ -5389,7 +5389,7 @@ CShape.prototype.getColumnNumber = function(){
}
_ret
.
x
=
oTransform
.
TransformPointX
(
oConnectorInfo
.
x
,
oConnectorInfo
.
y
);
_ret
.
y
=
oTransform
.
TransformPointY
(
oConnectorInfo
.
x
,
oConnectorInfo
.
y
);
_ret
.
bounds
.
fromOther
(
this
.
b
ounds
);
_ret
.
bounds
.
fromOther
(
oB
ounds
);
_ret
.
idx
=
oConnectorInfo
.
idx
;
return
_ret
;
};
...
...
common/Drawings/TrackObjects/AdjustmentTracks.js
View file @
1cde1b6b
...
...
@@ -45,7 +45,7 @@ function XYAdjustmentTrack(originalShape, adjIndex, bTextWarp)
this
.
geometry
=
originalShape
.
spPr
.
geometry
.
createDuplicate
();
this
.
shapeWidth
=
originalShape
.
extX
;
this
.
shapeHeight
=
originalShape
.
extY
;
this
.
transform
=
originalShape
.
transform
;
this
.
transform
=
originalShape
.
transform
.
CreateDublicate
()
;
this
.
invertTransform
=
originalShape
.
invertTransform
;
oPen
=
originalShape
.
pen
;
oBrush
=
originalShape
.
brush
;
...
...
@@ -141,122 +141,6 @@ function XYAdjustmentTrack(originalShape, adjIndex, bTextWarp)
},
this
,
[]);
this
.
draw
=
function
(
overlay
)
{
if
(
AscFormat
.
isRealNumber
(
this
.
originalShape
.
selectStartPage
)
&&
overlay
.
SetCurrentPage
)
{
overlay
.
SetCurrentPage
(
this
.
originalShape
.
selectStartPage
);
}
this
.
overlayObject
.
draw
(
overlay
);
};
this
.
track
=
function
(
posX
,
posY
)
{
var
invert_transform
=
this
.
invertTransform
;
var
_relative_x
=
invert_transform
.
TransformPointX
(
posX
,
posY
);
var
_relative_y
=
invert_transform
.
TransformPointY
(
posX
,
posY
);
var
bRecalculate
=
false
;
if
(
this
.
xFlag
)
{
var
_new_x
=
this
.
adjastment
.
minX
+
this
.
coeffX
*
(
_relative_x
-
this
.
minRealX
);
if
(
_new_x
<=
this
.
maximalRealativeX
&&
_new_x
>=
this
.
minimalRealativeX
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
!==
_new_x
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
=
_new_x
;
}
else
if
(
_new_x
>
this
.
maximalRealativeX
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
!==
this
.
maximalRealativeX
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
=
this
.
maximalRealativeX
;
}
else
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
!==
this
.
minimalRealativeX
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
=
this
.
minimalRealativeX
;
}
}
if
(
this
.
yFlag
)
{
var
_new_y
=
this
.
adjastment
.
minY
+
this
.
coeffY
*
(
_relative_y
-
this
.
minRealY
);
if
(
_new_y
<=
this
.
maximalRealativeY
&&
_new_y
>=
this
.
minimalRealativeY
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
!==
_new_y
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
=
_new_y
;
}
else
if
(
_new_y
>
this
.
maximalRealativeY
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
!==
this
.
maximalRealativeY
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
=
this
.
maximalRealativeY
;
}
else
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
!==
this
.
minimalRealativeY
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
=
this
.
minimalRealativeY
;
}
}
if
(
bRecalculate
)
this
.
geometry
.
Recalculate
(
this
.
shapeWidth
,
this
.
shapeHeight
);
};
this
.
trackEnd
=
function
()
{
var
oGeometryToSet
;
if
(
!
this
.
bTextWarp
)
{
oGeometryToSet
=
this
.
originalShape
.
spPr
.
geometry
;
if
(
this
.
xFlag
)
{
oGeometryToSet
.
setAdjValue
(
this
.
refX
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
+
""
);
}
if
(
this
.
yFlag
)
{
oGeometryToSet
.
setAdjValue
(
this
.
refY
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
+
""
);
}
}
else
{
var
new_body_pr
=
this
.
originalShape
.
getBodyPr
();
if
(
new_body_pr
)
{
oGeometryToSet
=
AscFormat
.
ExecuteNoHistory
(
function
(){
var
oGeom
=
this
.
geometry
.
createDuplicate
();
if
(
this
.
xFlag
)
{
oGeom
.
setAdjValue
(
this
.
refX
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
+
""
);
}
if
(
this
.
yFlag
)
{
oGeom
.
setAdjValue
(
this
.
refY
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
+
""
);
}
return
oGeom
;
},
this
,
[]);
new_body_pr
=
new_body_pr
.
createDuplicate
();
new_body_pr
.
prstTxWarp
=
oGeometryToSet
;
if
(
this
.
originalShape
.
bWordShape
)
{
this
.
originalShape
.
setBodyPr
(
new_body_pr
);
}
else
{
if
(
this
.
originalShape
.
txBody
)
{
this
.
originalShape
.
txBody
.
setBodyPr
(
new_body_pr
);
}
}
}
}
};
}
XYAdjustmentTrack
.
prototype
.
getBounds
=
function
()
...
...
@@ -294,6 +178,121 @@ XYAdjustmentTrack.prototype.getBounds = function()
return
bounds_checker
.
Bounds
;
};
XYAdjustmentTrack
.
prototype
.
draw
=
function
(
overlay
)
{
if
(
AscFormat
.
isRealNumber
(
this
.
originalShape
.
selectStartPage
)
&&
overlay
.
SetCurrentPage
)
{
overlay
.
SetCurrentPage
(
this
.
originalShape
.
selectStartPage
);
}
this
.
overlayObject
.
draw
(
overlay
);
};
XYAdjustmentTrack
.
prototype
.
track
=
function
(
posX
,
posY
)
{
var
invert_transform
=
this
.
invertTransform
;
var
_relative_x
=
invert_transform
.
TransformPointX
(
posX
,
posY
);
var
_relative_y
=
invert_transform
.
TransformPointY
(
posX
,
posY
);
var
bRecalculate
=
false
;
if
(
this
.
xFlag
)
{
var
_new_x
=
this
.
adjastment
.
minX
+
this
.
coeffX
*
(
_relative_x
-
this
.
minRealX
);
if
(
_new_x
<=
this
.
maximalRealativeX
&&
_new_x
>=
this
.
minimalRealativeX
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
!==
_new_x
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
=
_new_x
;
}
else
if
(
_new_x
>
this
.
maximalRealativeX
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
!==
this
.
maximalRealativeX
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
=
this
.
maximalRealativeX
;
}
else
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
!==
this
.
minimalRealativeX
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
=
this
.
minimalRealativeX
;
}
}
if
(
this
.
yFlag
)
{
var
_new_y
=
this
.
adjastment
.
minY
+
this
.
coeffY
*
(
_relative_y
-
this
.
minRealY
);
if
(
_new_y
<=
this
.
maximalRealativeY
&&
_new_y
>=
this
.
minimalRealativeY
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
!==
_new_y
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
=
_new_y
;
}
else
if
(
_new_y
>
this
.
maximalRealativeY
)
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
!==
this
.
maximalRealativeY
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
=
this
.
maximalRealativeY
;
}
else
{
if
(
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
!==
this
.
minimalRealativeY
)
bRecalculate
=
true
;
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
=
this
.
minimalRealativeY
;
}
}
if
(
bRecalculate
)
this
.
geometry
.
Recalculate
(
this
.
shapeWidth
,
this
.
shapeHeight
);
};
XYAdjustmentTrack
.
prototype
.
trackEnd
=
function
()
{
var
oGeometryToSet
;
if
(
!
this
.
bTextWarp
)
{
oGeometryToSet
=
this
.
originalShape
.
spPr
.
geometry
;
if
(
this
.
xFlag
)
{
oGeometryToSet
.
setAdjValue
(
this
.
refX
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
+
""
);
}
if
(
this
.
yFlag
)
{
oGeometryToSet
.
setAdjValue
(
this
.
refY
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
+
""
);
}
}
else
{
var
new_body_pr
=
this
.
originalShape
.
getBodyPr
();
if
(
new_body_pr
)
{
oGeometryToSet
=
AscFormat
.
ExecuteNoHistory
(
function
(){
var
oGeom
=
this
.
geometry
.
createDuplicate
();
if
(
this
.
xFlag
)
{
oGeom
.
setAdjValue
(
this
.
refX
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefX
]
+
""
);
}
if
(
this
.
yFlag
)
{
oGeom
.
setAdjValue
(
this
.
refY
,
this
.
geometry
.
gdLst
[
this
.
adjastment
.
gdRefY
]
+
""
);
}
return
oGeom
;
},
this
,
[]);
new_body_pr
=
new_body_pr
.
createDuplicate
();
new_body_pr
.
prstTxWarp
=
oGeometryToSet
;
if
(
this
.
originalShape
.
bWordShape
)
{
this
.
originalShape
.
setBodyPr
(
new_body_pr
);
}
else
{
if
(
this
.
originalShape
.
txBody
)
{
this
.
originalShape
.
txBody
.
setBodyPr
(
new_body_pr
);
}
}
}
}
};
function
PolarAdjustmentTrack
(
originalShape
,
adjIndex
,
bTextWarp
)
{
AscFormat
.
ExecuteNoHistory
(
function
(){
...
...
common/Drawings/TrackObjects/ConnectorTrack.js
0 → 100644
View file @
1cde1b6b
/**
* Created by Sergey.Luzyanin on 5/11/2017.
*/
(
function
()
{
function
CConnectorTrack
(
oConnector
,
oBeginTrack
,
oEndTrack
,
oBeginShape
,
oEndShape
){
this
.
connector
=
oConnector
;
this
.
beginTrack
=
oBeginTrack
;
this
.
endTrack
=
oEndTrack
;
this
.
beginShape
=
oBeginShape
;
this
.
endShape
=
oEndShape
;
this
.
startX
=
this
.
connector
.
transform
.
TransformPointX
(
0
,
0
);
this
.
startY
=
this
.
connector
.
transform
.
TransformPointY
(
0
,
0
);
this
.
endX
=
this
.
connector
.
transform
.
TransformPointX
(
this
.
connector
.
extX
,
this
.
connector
.
extY
);
this
.
endY
=
this
.
connector
.
transform
.
TransformPointY
(
this
.
connector
.
extX
,
this
.
connector
.
extY
);
this
.
oSpPr
=
AscFormat
.
ExecuteNoHistory
(
function
()
{
return
oConnector
.
spPr
.
createDuplicate
();
},
this
,
[]);
AscFormat
.
XYAdjustmentTrack
.
call
(
this
,
oConnector
,
-
1
,
false
);
}
CConnectorTrack
.
prototype
=
Object
.
create
(
AscFormat
.
XYAdjustmentTrack
.
prototype
);
CConnectorTrack
.
prototype
.
track
=
function
()
{
var
oConnectorInfo
=
this
.
connector
.
nvSpPr
.
nvUniSpPr
;
var
_rot
,
track_bounds
,
g_conn_info
,
oConectionObject
;
var
_startConnectionParams
=
null
;
var
_endConnectionParams
=
null
;
if
(
this
.
beginTrack
){
track_bounds
=
this
.
convertTrackBounds
(
this
.
beginTrack
.
getBounds
());
_rot
=
AscFormat
.
isRealNumber
(
this
.
beginTrack
.
rot
)
?
this
.
beginTrack
.
rot
:
this
.
beginTrack
.
originalObject
.
rot
;
oConectionObject
=
this
.
beginTrack
.
overlayObject
.
geometry
.
cnxLst
[
oConnectorInfo
.
stCnxIdx
];
g_conn_info
=
{
idx
:
oConnectorInfo
.
stCnxIdx
,
ang
:
oConectionObject
.
ang
,
x
:
oConectionObject
.
x
,
y
:
oConectionObject
.
y
};
_startConnectionParams
=
this
.
connector
.
convertToConnectionParams
(
_rot
,
this
.
beginTrack
.
overlayObject
.
TransformMatrix
,
track_bounds
,
g_conn_info
)
}
if
(
this
.
endTrack
){
track_bounds
=
this
.
convertTrackBounds
(
this
.
endTrack
.
getBounds
());
_rot
=
AscFormat
.
isRealNumber
(
this
.
endTrack
.
rot
)
?
this
.
endTrack
.
rot
:
this
.
endTrack
.
originalObject
.
rot
;
oConectionObject
=
this
.
endTrack
.
overlayObject
.
geometry
.
cnxLst
[
oConnectorInfo
.
endCnxIdx
];
g_conn_info
=
{
idx
:
oConnectorInfo
.
endCnxIdx
,
ang
:
oConectionObject
.
ang
,
x
:
oConectionObject
.
x
,
y
:
oConectionObject
.
y
};
_endConnectionParams
=
this
.
connector
.
convertToConnectionParams
(
_rot
,
this
.
endTrack
.
overlayObject
.
TransformMatrix
,
track_bounds
,
g_conn_info
)
}
if
(
_startConnectionParams
||
_endConnectionParams
){
if
(
!
_startConnectionParams
){
if
(
this
.
beginShape
&&
oConnectorInfo
.
stCnxIdx
!==
null
){
oConectionObject
=
this
.
beginShape
.
spPr
.
geometry
.
cnxLst
[
oConnectorInfo
.
stCnxIdx
];
g_conn_info
=
{
idx
:
oConnectorInfo
.
stCnxIdx
,
ang
:
oConectionObject
.
ang
,
x
:
oConectionObject
.
x
,
y
:
oConectionObject
.
y
};
_startConnectionParams
=
this
.
beginShape
.
convertToConnectionParams
(
this
.
beginShape
.
rot
,
this
.
beginShape
.
transform
,
this
.
beginShape
.
bounds
,
g_conn_info
)
}
else
{
_startConnectionParams
=
AscFormat
.
fCalculateConnectionInfo
(
_endConnectionParams
,
this
.
startX
,
this
.
startY
);
}
}
if
(
!
_endConnectionParams
){
if
(
this
.
endShape
&&
oConnectorInfo
.
endCnxIdx
!==
null
){
oConectionObject
=
this
.
endShape
.
spPr
.
geometry
.
cnxLst
[
oConnectorInfo
.
endCnxIdx
];
g_conn_info
=
{
idx
:
oConnectorInfo
.
endCnxIdx
,
ang
:
oConectionObject
.
ang
,
x
:
oConectionObject
.
x
,
y
:
oConectionObject
.
y
};
_endConnectionParams
=
this
.
endShape
.
convertToConnectionParams
(
this
.
endShape
.
rot
,
this
.
endShape
.
transform
,
this
.
endShape
.
bounds
,
g_conn_info
)
}
else
{
_endConnectionParams
=
AscFormat
.
fCalculateConnectionInfo
(
_endConnectionParams
,
this
.
endX
,
this
.
endY
);
}
}
this
.
oSpPr
=
AscFormat
.
fCalculateSpPr
(
_startConnectionParams
,
_endConnectionParams
,
this
.
connector
.
spPr
.
geometry
.
preset
,
this
.
overlayObject
.
pen
.
w
);
}
this
.
geometry
.
Recalculate
(
this
.
oSpPr
.
xfrm
.
extX
,
this
.
oSpPr
.
xfrm
.
extY
);
var
_transform
=
this
.
transform
;
_transform
.
Reset
();
var
_horizontal_center
=
this
.
oSpPr
.
xfrm
.
extX
*
0.5
;
var
_vertical_center
=
this
.
oSpPr
.
xfrm
.
extY
*
0.5
;
global_MatrixTransformer
.
TranslateAppend
(
_transform
,
-
_horizontal_center
,
-
_vertical_center
);
if
(
this
.
oSpPr
.
xfrm
.
flipH
)
{
global_MatrixTransformer
.
ScaleAppend
(
_transform
,
-
1
,
1
);
}
if
(
this
.
oSpPr
.
xfrm
.
flipV
)
{
global_MatrixTransformer
.
ScaleAppend
(
_transform
,
1
,
-
1
);
}
global_MatrixTransformer
.
RotateRadAppend
(
_transform
,
-
(
AscFormat
.
isRealNumber
(
this
.
oSpPr
.
xfrm
.
rot
)
?
this
.
oSpPr
.
xfrm
.
rot
:
0
));
global_MatrixTransformer
.
TranslateAppend
(
_transform
,
this
.
oSpPr
.
xfrm
.
offX
,
this
.
oSpPr
.
xfrm
.
offY
);
global_MatrixTransformer
.
TranslateAppend
(
_transform
,
_horizontal_center
,
_vertical_center
);
};
CConnectorTrack
.
prototype
.
trackEnd
=
function
()
{
this
.
connector
.
setSpPr
(
this
.
oSpPr
.
createDuplicate
());
this
.
connector
.
spPr
.
setParent
(
this
.
connector
);
};
CConnectorTrack
.
prototype
.
convertTrackBounds
=
function
(
trackBounds
)
{
return
new
AscFormat
.
CGraphicBounds
(
trackBounds
.
min_x
,
trackBounds
.
min_y
,
trackBounds
.
max_x
,
trackBounds
.
max_y
);
};
window
[
'
AscFormat
'
]
=
window
[
'
AscFormat
'
]
||
{};
window
[
'
AscFormat
'
].
CConnectorTrack
=
CConnectorTrack
;
})();
common/Drawings/TrackObjects/NewShapeTracks.js
View file @
1cde1b6b
...
...
@@ -558,10 +558,6 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
this
.
getShape
=
function
(
bFromWord
,
DrawingDocument
,
drawingObjects
)
{
var
_sp_pr
;
if
(
this
.
lastSpPr
){
...
...
common/Drawings/TrackObjects/RotateTracks.js
View file @
1cde1b6b
...
...
@@ -167,7 +167,7 @@ function OverlayObject(geometry, extX, extY, brush, pen, transform )
&&
this
.
pen
.
Fill
.
fill
.
type
!=
c_oAscFill
.
FILL_TYPE_NOFILL
&&
this
.
pen
.
Fill
.
fill
.
type
!=
c_oAscFill
.
FILL_TYPE_NONE
)
||
(
this
.
brush
&&
this
.
brush
.
fill
&&
this
.
brush
.
fill
&&
this
.
brush
.
fill
.
type
!=
c_oAscFill
.
FILL_TYPE_NOFILL
&&
this
.
brush
.
fill
.
type
!=
c_oAscFill
.
FILL_TYPE_NONE
)
);
}
}
;
this
.
check_bounds
=
function
(
boundsChecker
)
...
...
@@ -186,7 +186,7 @@ function OverlayObject(geometry, extX, extY, brush, pen, transform )
boundsChecker
.
_z
();
boundsChecker
.
_e
();
}
}
}
;
}
function
ObjectToDraw
(
brush
,
pen
,
extX
,
extY
,
geometry
,
transform
,
x
,
y
,
oComment
)
...
...
common/HistoryCommon.js
View file @
1cde1b6b
...
...
@@ -1236,6 +1236,7 @@
window
[
'
AscDFH
'
].
historyitem_type_Sparkline
=
1127
<<
16
;
window
[
'
AscDFH
'
].
historyitem_type_NotesMaster
=
1128
<<
16
;
window
[
'
AscDFH
'
].
historyitem_type_Notes
=
1129
<<
16
;
window
[
'
AscDFH
'
].
historyitem_type_Cnx
=
1130
<<
16
;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment