Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MUR Drupal
d3-library
Commits
248effcd
Commit
248effcd
authored
Jul 05, 2013
by
Mike Bostock
Browse files
Merge branch 'fix-basis-marker' into 3.2.4
parents
68809d3d
c6bad2fb
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
d3.js
View file @
248effcd
...
...
@@ -4079,9 +4079,9 @@ d3 = function() {
}
function
d3_svg_lineBasis
(
points
)
{
if
(
points
.
length
<
3
)
return
d3_svg_lineLinear
(
points
);
var
i
=
1
,
n
=
points
.
length
,
pi
=
points
[
0
],
x0
=
pi
[
0
],
y0
=
pi
[
1
],
px
=
[
x0
,
x0
,
x0
,
(
pi
=
points
[
1
])[
0
]
],
py
=
[
y0
,
y0
,
y0
,
pi
[
1
]
],
path
=
[
x0
,
"
,
"
,
y0
];
d3_svg_lineBasisBezier
(
path
,
px
,
py
);
while
(
++
i
<
n
)
{
var
i
=
1
,
n
=
points
.
length
,
pi
=
points
[
0
],
x0
=
pi
[
0
],
y0
=
pi
[
1
],
px
=
[
x0
,
x0
,
x0
,
(
pi
=
points
[
1
])[
0
]
],
py
=
[
y0
,
y0
,
y0
,
pi
[
1
]
],
path
=
[
x0
,
"
,
"
,
y0
,
"
L
"
,
d3_svg_lineDot4
(
d3_svg_lineBasisBezier3
,
px
),
"
,
"
,
d3_svg_lineDot4
(
d3_svg_lineBasisBezier3
,
py
)
];
points
.
push
(
points
[
n
-
1
]
);
while
(
++
i
<
=
n
)
{
pi
=
points
[
i
];
px
.
shift
();
px
.
push
(
pi
[
0
]);
...
...
@@ -4089,14 +4089,8 @@ d3 = function() {
py
.
push
(
pi
[
1
]);
d3_svg_lineBasisBezier
(
path
,
px
,
py
);
}
i
=
-
1
;
while
(
++
i
<
2
)
{
px
.
shift
();
px
.
push
(
pi
[
0
]);
py
.
shift
();
py
.
push
(
pi
[
1
]);
d3_svg_lineBasisBezier
(
path
,
px
,
py
);
}
points
.
pop
();
path
.
push
(
"
L
"
,
pi
);
return
path
.
join
(
""
);
}
function
d3_svg_lineBasisOpen
(
points
)
{
...
...
d3.min.js
View file @
248effcd
This diff is collapsed.
Click to expand it.
src/svg/line.js
View file @
248effcd
...
...
@@ -249,20 +249,16 @@ function d3_svg_lineBasis(points) {
y0
=
pi
[
1
],
px
=
[
x0
,
x0
,
x0
,
(
pi
=
points
[
1
])[
0
]],
py
=
[
y0
,
y0
,
y0
,
pi
[
1
]],
path
=
[
x0
,
"
,
"
,
y0
];
d3_svg_lineBasisBezier
(
path
,
px
,
py
);
while
(
++
i
<
n
)
{
path
=
[
x0
,
"
,
"
,
y0
,
"
L
"
,
d3_svg_lineDot4
(
d3_svg_lineBasisBezier3
,
px
),
"
,
"
,
d3_svg_lineDot4
(
d3_svg_lineBasisBezier3
,
py
)
];
points
.
push
(
points
[
n
-
1
]
);
while
(
++
i
<
=
n
)
{
pi
=
points
[
i
];
px
.
shift
();
px
.
push
(
pi
[
0
]);
py
.
shift
();
py
.
push
(
pi
[
1
]);
d3_svg_lineBasisBezier
(
path
,
px
,
py
);
}
i
=
-
1
;
while
(
++
i
<
2
)
{
px
.
shift
();
px
.
push
(
pi
[
0
]);
py
.
shift
();
py
.
push
(
pi
[
1
]);
d3_svg_lineBasisBezier
(
path
,
px
,
py
);
}
points
.
pop
();
path
.
push
(
"
L
"
,
pi
);
return
path
.
join
(
""
);
}
...
...
test/svg/line-test.js
View file @
248effcd
...
...
@@ -110,7 +110,7 @@ suite.addBatch({
"
interpolate(basis)
"
:
{
"
supports basis interpolation
"
:
function
(
line
)
{
var
l
=
line
().
interpolate
(
"
basis
"
);
assert
.
pathEqual
(
l
([[
0
,
0
],
[
1
,
1
],
[
2
,
0
],
[
3
,
1
],
[
4
,
0
]]),
"
M0,0
C0,0,0,0,
0.16666666666666666,0.16666666666666666C0.3333333333333333,0.3333333333333333,0.6666666666666666,0.6666666666666666,1,0.6666666666666666C1.3333333333333333,0.6666666666666666,1.6666666666666665,0.3333333333333333,2,0.3333333333333333C2.333333333333333,0.3333333333333333,2.6666666666666665,0.6666666666666666,3,0.6666666666666666C3.333333333333333,0.6666666666666666,3.6666666666666665,0.3333333333333333,3.833333333333333,0.16666666666666666
C4,0,4,0,3.9999999999999996
,0
"
);
assert
.
pathEqual
(
l
([[
0
,
0
],
[
1
,
1
],
[
2
,
0
],
[
3
,
1
],
[
4
,
0
]]),
"
M0,0
L
0.16666666666666666,0.16666666666666666C0.3333333333333333,0.3333333333333333,0.6666666666666666,0.6666666666666666,1,0.6666666666666666C1.3333333333333333,0.6666666666666666,1.6666666666666665,0.3333333333333333,2,0.3333333333333333C2.333333333333333,0.3333333333333333,2.6666666666666665,0.6666666666666666,3,0.6666666666666666C3.333333333333333,0.6666666666666666,3.6666666666666665,0.3333333333333333,3.833333333333333,0.16666666666666666
L4
,0
"
);
},
"
supports basis-open interpolation
"
:
function
(
line
)
{
var
l
=
line
().
interpolate
(
"
basis-open
"
);
...
...
@@ -141,7 +141,7 @@ suite.addBatch({
"
interpolate(bundle)
"
:
{
"
supports bundle interpolation
"
:
function
(
line
)
{
var
l
=
line
().
interpolate
(
"
bundle
"
);
assert
.
pathEqual
(
l
([[
0
,
0
],
[
1
,
1
],
[
2
,
0
],
[
3
,
1
],
[
4
,
0
]]),
"
M0,0
C0,0,0,0,
0.16666666666666666,0.11666666666666665C0.3333333333333333,0.2333333333333333,0.6666666666666666,0.4666666666666666,1,0.4666666666666666C1.3333333333333333,0.4666666666666666,1.6666666666666665,0.2333333333333333,2,0.2333333333333333C2.333333333333333,0.2333333333333333,2.6666666666666665,0.4666666666666666,3,0.4666666666666666C3.333333333333333,0.4666666666666666,3.6666666666666665,0.2333333333333333,3.833333333333333,0.11666666666666665
C4,0,4,0,
4,0
"
);
assert
.
pathEqual
(
l
([[
0
,
0
],
[
1
,
1
],
[
2
,
0
],
[
3
,
1
],
[
4
,
0
]]),
"
M0,0
L
0.16666666666666666,0.11666666666666665C0.3333333333333333,0.2333333333333333,0.6666666666666666,0.4666666666666666,1,0.4666666666666666C1.3333333333333333,0.4666666666666666,1.6666666666666665,0.2333333333333333,2,0.2333333333333333C2.333333333333333,0.2333333333333333,2.6666666666666665,0.4666666666666666,3,0.4666666666666666C3.333333333333333,0.4666666666666666,3.6666666666666665,0.2333333333333333,3.833333333333333,0.11666666666666665
L
4,0
"
);
},
"
observes the specified tension
"
:
function
(
line
)
{
var
l
=
line
().
interpolate
(
"
bundle
"
).
tension
(
1
);
...
...
Write
Preview
Supports
Markdown
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