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
0bb5843e
Commit
0bb5843e
authored
May 11, 2017
by
SergeyLuzyanin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
connectors
parent
ea5ae2d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
37 deletions
+39
-37
common/Drawings/Format/CnxShape.js
common/Drawings/Format/CnxShape.js
+38
-36
common/Drawings/TrackObjects/NewShapeTracks.js
common/Drawings/TrackObjects/NewShapeTracks.js
+1
-1
No files found.
common/Drawings/Format/CnxShape.js
View file @
0bb5843e
...
...
@@ -34,7 +34,7 @@
this
.
y
=
_y
;
};
function
fCalculateSpPr
(
begin
,
end
,
sPreset
){
function
fCalculateSpPr
(
begin
,
end
,
sPreset
,
penW
){
return
AscFormat
.
ExecuteNoHistory
(
function
(){
var
oSpPr
=
new
AscFormat
.
CSpPr
();
var
oXfrm
=
new
AscFormat
.
CXfrm
();
...
...
@@ -45,6 +45,10 @@
var
_end
=
end
.
copy
();
var
fAngle
=
0
;
if
(
!
penW
){
penW
=
12700
;
}
switch
(
begin
.
dir
){
case
AscFormat
.
CARD_DIRECTION_N
:{
fAngle
=
Math
.
PI
/
2
;
...
...
@@ -126,8 +130,8 @@
var
posX
=
Math
.
min
(
_begin
.
x
,
_end
.
x
);
var
posY
=
Math
.
min
(
_begin
.
y
,
_end
.
y
);
var
extX
=
Math
.
abs
(
_end
.
x
-
_begin
.
x
);
var
extY
=
Math
.
abs
(
_end
.
y
-
_begin
.
y
);
var
extX
=
Math
.
max
(
penW
/
36000.0
,
Math
.
abs
(
_end
.
x
-
_begin
.
x
)
);
var
extY
=
Math
.
max
(
penW
/
36000.0
,
Math
.
abs
(
_end
.
y
-
_begin
.
y
)
);
var
flipV
=
false
;
var
flipH
=
false
;
var
rot
=
0
;
...
...
@@ -136,18 +140,19 @@
var
xc
=
posX
+
extX
/
2
,
yc
=
posY
+
extY
/
2
;
if
(
sPreset
===
"
line
"
){
}
else
if
(
sPreset
.
indexOf
(
"
curvedConnector
"
)
>
0
){
}
else
{
var
sPrefix
=
"
bentConnector
"
;
if
(
sPreset
.
indexOf
(
"
curvedConnector
"
)
>
-
1
){
sPrefix
=
"
curvedConnector
"
;
}
//returns "bentConnector" by default
switch
(
_end
.
dir
){
case
AscFormat
.
CARD_DIRECTION_N
:{
if
(
_end
.
bounds
.
l
>
_begin
.
bounds
.
r
){
if
(
_end
.
y
<=
_begin
.
y
){
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
3.0
*
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -160,7 +165,7 @@
oMapAdj
[
"
adj1
"
]
=
(
-
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
bentConnector
2
"
;
sPreset
=
"
2
"
;
rot
=
3.0
*
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -173,7 +178,7 @@
else
{
if
(
_end
.
y
<=
_begin
.
bounds
.
b
){
if
(
_end
.
y
<=
_begin
.
y
){
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
3.0
*
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -185,7 +190,7 @@
oMapAdj
[
"
adj2
"
]
=
100000
+
(
100000
*
(
Math
.
max
(
CONNECTOR_MARGIN
,
_end
.
bounds
.
r
+
CONNECTOR_MARGIN
-
_begin
.
x
)
/
extY
)
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -200,7 +205,7 @@
}
else
{
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -218,7 +223,7 @@
case
AscFormat
.
CARD_DIRECTION_S
:{
if
(
_end
.
bounds
.
l
>
_begin
.
bounds
.
r
){
if
(
_end
.
bounds
.
b
<
_begin
.
y
){
sPreset
=
"
bentConnector
2
"
;
sPreset
=
"
2
"
;
rot
=
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -227,7 +232,7 @@
posY
=
(
_end
.
y
+
_begin
.
y
)
/
2.0
-
extY
/
2.0
;
}
else
{
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -243,7 +248,7 @@
if
(
_end
.
bounds
.
b
<
_begin
.
bounds
.
t
){
if
(
_end
.
x
>
_begin
.
bounds
.
r
){
sPreset
=
"
bentConnector
2
"
;
sPreset
=
"
2
"
;
rot
=
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -252,7 +257,7 @@
posY
=
(
_end
.
y
+
_begin
.
y
)
/
2.0
-
extY
/
2.0
;
}
else
{
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
3.0
*
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -269,7 +274,7 @@
if
(
_end
.
x
<
_begin
.
x
){
if
(
_end
.
y
>
_begin
.
y
){
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -283,7 +288,7 @@
oMapAdj
[
"
adj2
"
]
=
100000
+
(
100000
*
(
Math
.
max
(
CONNECTOR_MARGIN
,
_end
.
bounds
.
r
+
CONNECTOR_MARGIN
-
_begin
.
x
)
/
extY
)
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
flipH
=
true
;
flipV
=
true
;
oMapAdj
[
"
adj1
"
]
=
-
((
100000
*
(
Math
.
max
(
_begin
.
bounds
.
r
,
_end
.
bounds
.
r
)
+
CONNECTOR_MARGIN
-
begin
.
x
)
/
extX
+
0.5
)
>>
0
);
...
...
@@ -291,7 +296,7 @@
}
}
else
{
sPreset
=
"
bentConnector
4
"
;
sPreset
=
"
4
"
;
rot
=
Math
.
PI
/
2.0
;
tmp
=
extX
;
extX
=
extY
;
...
...
@@ -310,15 +315,15 @@
case
AscFormat
.
CARD_DIRECTION_W
:{
if
(
_begin
.
x
<
_end
.
x
){
sPreset
=
"
bentConnector
3
"
;
sPreset
=
"
3
"
;
flipV
=
_begin
.
y
>
_end
.
y
;
}
else
{
sPreset
=
"
bentConnector
5
"
;
sPreset
=
"
5
"
;
rot
=
Math
.
PI
;
flipH
=
true
;
oMapAdj
[
"
adj3
"
]
=
(
100000
+
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
;
var
leftX
=
_end
.
x
-
Math
.
min
(
_begin
.
bounds
.
l
,
_end
.
bounds
.
l
)
+
CONNECTOR_MARGIN
;
var
leftX
=
_end
.
x
-
_end
.
bounds
.
l
+
CONNECTOR_MARGIN
;
oMapAdj
[
"
adj1
"
]
=
(
-
100000
*
(
leftX
/
extX
)
+
0.5
)
>>
0
;
if
(
_end
.
bounds
.
b
<
_begin
.
bounds
.
t
||
_end
.
bounds
.
t
>
_begin
.
bounds
.
b
){
if
(
_end
.
bounds
.
b
<
_begin
.
bounds
.
t
){
...
...
@@ -344,29 +349,26 @@
case
AscFormat
.
CARD_DIRECTION_E
:{
if
(
_end
.
bounds
.
l
>
_begin
.
bounds
.
r
){
if
(
_end
.
bounds
.
b
<
_begin
.
y
){
sPreset
=
"
bentConnector
3
"
;
sPreset
=
"
3
"
;
flipH
=
true
;
oMapAdj
[
"
adj1
"
]
=
-
(
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
;
}
else
if
(
_end
.
bounds
.
t
>
_begin
.
y
){
sPreset
=
"
bentConnector5
"
;
flipV
=
true
;
sPreset
=
"
3
"
;
oMapAdj
[
"
adj1
"
]
=
(
100000
*
((
_end
.
bounds
.
l
+
_begin
.
bounds
.
r
)
/
2
-
_begin
.
x
)
/
extX
+
0.5
)
>>
0
;
oMapAdj
[
"
adj2
"
]
=
(
100000
+
(
_end
.
y
-
(
_end
.
bounds
.
t
-
CONNECTOR_MARGIN
))
/
extY
+
0.5
)
>>
0
;
oMapAdj
[
"
adj3
"
]
=
100000
+
(
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
;
oMapAdj
[
"
adj1
"
]
=
100000
+
(
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
;
}
else
{
if
(
_end
.
y
<
_begin
.
y
){
sPreset
=
"
bentConnector
5
"
;
sPreset
=
"
5
"
;
flipV
=
true
;
oMapAdj
[
"
adj1
"
]
=
(
100000
*
((
_end
.
bounds
.
l
+
_begin
.
bounds
.
r
)
/
2
-
_begin
.
x
)
/
extX
+
0.5
)
>>
0
;
oMapAdj
[
"
adj2
"
]
=
(
100000
+
100000
*
(
_end
.
y
-
(
_end
.
bounds
.
t
-
CONNECTOR_MARGIN
))
/
extY
+
0.5
)
>>
0
;
oMapAdj
[
"
adj3
"
]
=
100000
+
(
100000
*
(
_end
.
bounds
.
r
+
CONNECTOR_MARGIN
-
_end
.
x
)
/
extX
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
bentConnector
5
"
;
sPreset
=
"
5
"
;
oMapAdj
[
"
adj1
"
]
=
(
100000
*
((
_end
.
bounds
.
l
+
_begin
.
bounds
.
r
)
/
2
-
_begin
.
x
)
/
extX
+
0.5
)
>>
0
;
oMapAdj
[
"
adj2
"
]
=
-
(
100000
*
(
begin
.
y
-
(
_end
.
bounds
.
t
-
CONNECTOR_MARGIN
))
/
extY
+
0.5
)
>>
0
;
oMapAdj
[
"
adj3
"
]
=
100000
+
(
100000
*
(
_end
.
bounds
.
r
+
CONNECTOR_MARGIN
-
_end
.
x
)
/
extX
+
0.5
)
>>
0
;
...
...
@@ -379,37 +381,37 @@
if
(
_end
.
x
<
_begin
.
x
){
flipH
=
true
;
flipV
=
true
;
sPreset
=
"
bentConnector
3
"
;
sPreset
=
"
3
"
;
oMapAdj
[
"
adj1
"
]
=
-
(
100000
*
(
Math
.
max
(
_end
.
bounds
.
r
,
_begin
.
bounds
.
r
)
+
CONNECTOR_MARGIN
-
_begin
.
x
)
/
extX
+
0.5
)
>>
0
;
}
else
{
flipV
=
true
;
sPreset
=
"
bentConnector
3
"
;
sPreset
=
"
3
"
;
oMapAdj
[
"
adj1
"
]
=
100000
+
(
100000
*
(
Math
.
max
(
_end
.
bounds
.
r
,
_begin
.
bounds
.
r
)
+
CONNECTOR_MARGIN
-
_end
.
x
)
/
extX
+
0.5
)
>>
0
;
}
}
else
{
if
(
_end
.
x
<
_begin
.
x
){
flipH
=
true
;
sPreset
=
"
bentConnector
3
"
;
sPreset
=
"
3
"
;
oMapAdj
[
"
adj1
"
]
=
-
(
100000
*
(
Math
.
max
(
_end
.
bounds
.
r
,
_begin
.
bounds
.
r
)
+
CONNECTOR_MARGIN
-
_begin
.
x
)
/
extX
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
bentConnector
3
"
;
sPreset
=
"
3
"
;
oMapAdj
[
"
adj1
"
]
=
100000
+
(
100000
*
(
Math
.
max
(
_end
.
bounds
.
r
,
_begin
.
bounds
.
r
)
+
CONNECTOR_MARGIN
-
_end
.
x
)
/
extX
+
0.5
)
>>
0
;
}
}
}
else
{
if
(
_end
.
y
>=
_begin
.
y
){
sPreset
=
"
bentConnector
5
"
;
sPreset
=
"
5
"
;
flipH
=
true
;
oMapAdj
[
"
adj1
"
]
=
-
((
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
);
oMapAdj
[
"
adj2
"
]
=
(
100000
+
100000
*
(
_begin
.
bounds
.
b
+
CONNECTOR_MARGIN
-
_end
.
y
)
/
extY
+
0.5
)
>>
0
;
oMapAdj
[
"
adj3
"
]
=
(
100000
*
(
_begin
.
x
-
(
_end
.
bounds
.
r
+
_begin
.
bounds
.
l
)
/
2.0
)
/
extX
+
0.5
)
>>
0
;
}
else
{
sPreset
=
"
bentConnector
5
"
;
sPreset
=
"
5
"
;
flipH
=
true
;
flipV
=
true
;
oMapAdj
[
"
adj1
"
]
=
-
((
100000
*
(
CONNECTOR_MARGIN
/
extX
)
+
0.5
)
>>
0
);
...
...
@@ -421,8 +423,8 @@
break
;
}
}
sPreset
=
sPrefix
+
sPreset
;
}
var
_posX
=
(
end
.
x
+
begin
.
x
)
/
2.0
-
extX
/
2.0
;
var
_posY
=
(
end
.
y
+
begin
.
y
)
/
2.0
-
extY
/
2.0
;
var
_fAng
=
AscFormat
.
normalizeRotate
(
rot
-
fAngle
);
...
...
common/Drawings/TrackObjects/NewShapeTracks.js
View file @
0bb5843e
...
...
@@ -300,7 +300,7 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
else
if
(
!
_endInfo
){
_endInfo
=
AscFormat
.
fCalculateConnectionInfo
(
_startInfo
,
x
,
y
);
}
var
oSpPr
=
AscFormat
.
fCalculateSpPr
(
_startInfo
,
_endInfo
,
this
.
presetGeom
);
var
oSpPr
=
AscFormat
.
fCalculateSpPr
(
_startInfo
,
_endInfo
,
this
.
presetGeom
,
this
.
overlayObject
.
pen
.
w
);
this
.
flipH
=
oSpPr
.
xfrm
.
flipH
===
true
;
this
.
flipV
=
oSpPr
.
xfrm
.
flipV
===
true
;
this
.
rot
=
AscFormat
.
isRealNumber
(
oSpPr
.
xfrm
.
rot
)
?
oSpPr
.
xfrm
.
rot
:
0
;
...
...
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