Fix a bug in preserving fixed state.

This commit is contained in:
Mike Bostock 2012-09-03 18:56:32 -07:00
Родитель dceb459a27
Коммит 0c1d23d384
3 изменённых файлов: 18 добавлений и 12 удалений

14
d3.v2.js поставляемый
Просмотреть файл

@ -4177,17 +4177,17 @@
return d3.rebind(force, event, "on");
};
function d3_layout_forceDragstart(d) {
d.fixed |= 1;
}
function d3_layout_forceDragend(d) {
d.fixed &= 2;
}
function d3_layout_forceMouseover(d) {
d.fixed |= 2;
}
function d3_layout_forceMouseout(d) {
function d3_layout_forceDragend(d) {
d.fixed &= 1;
}
function d3_layout_forceMouseover(d) {
d.fixed |= 4;
}
function d3_layout_forceMouseout(d) {
d.fixed &= 3;
}
function d3_layout_forceAccumulate(quad, alpha, charges) {
var cx = 0, cy = 0;
quad.charge = 0;

2
d3.v2.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -292,20 +292,26 @@ d3.layout.force = function() {
return d3.rebind(force, event, "on");
};
// The fixed property has three bits:
// Bit 1 can be set externally (e.g., d.fixed = true) and show persist.
// Bit 2 stores the dragging state, from mousedown to mouseup.
// Bit 3 stores the hover state, from mouseover to mouseout.
// Dragend is a special case: it also clears the hover state.
function d3_layout_forceDragstart(d) {
d.fixed |= 1;
d.fixed |= 2; // set bit 2
}
function d3_layout_forceDragend(d) {
d.fixed &= 2;
d.fixed &= 1; // unset bits 2 and 3
}
function d3_layout_forceMouseover(d) {
d.fixed |= 2;
d.fixed |= 4; // set bit 3
}
function d3_layout_forceMouseout(d) {
d.fixed &= 1;
d.fixed &= 3; // unset bit 3
}
function d3_layout_forceAccumulate(quad, alpha, charges) {