Commit ed1e10f3 authored by Masayuki Tanaka's avatar Masayuki Tanaka Committed by masayuki

Fix code style

parent 524a27e9
...@@ -783,7 +783,7 @@ ...@@ -783,7 +783,7 @@
.on('click', function(d,i) { .on('click', function(d,i) {
main.selectAll('.target-circle-'+i+', .target-bar-'+i).each(function(d){ main.selectAll('.target-circle-'+i+', .target-bar-'+i).each(function(d){
var _this = d3.select(this), var _this = d3.select(this),
_selected = _this.classed('_s_') isSelected = _this.classed('_s_')
var isWithin = false, toggle var isWithin = false, toggle
if (this.nodeName === 'circle') { if (this.nodeName === 'circle') {
isWithin = isWithinCircle(this, __point_select_r*1.5) isWithin = isWithinCircle(this, __point_select_r*1.5)
...@@ -795,8 +795,8 @@ ...@@ -795,8 +795,8 @@
} }
if (__data_selection_grouped || isWithin) { if (__data_selection_grouped || isWithin) {
if (__data_selection_enabled && __data_selection_isselectable(d)) { if (__data_selection_enabled && __data_selection_isselectable(d)) {
_this.classed('_s_', !_selected) _this.classed('_s_', !isSelected)
toggle(!_selected, _this, d, i) toggle(!isSelected, _this, d, i)
} }
__point_onclick(d, _this) // TODO: should be __data_onclick __point_onclick(d, _this) // TODO: should be __data_onclick
} }
...@@ -810,41 +810,41 @@ ...@@ -810,41 +810,41 @@
mouse = d3.mouse(this), mouse = d3.mouse(this),
mx = mouse[0], mx = mouse[0],
my = mouse[1], my = mouse[1],
min_x = Math.min(sx,mx), minX = Math.min(sx,mx),
max_x = Math.max(sx,mx), maxX = Math.max(sx,mx),
min_y = (__data_selection_grouped) ? margin.top : Math.min(sy,my), minY = (__data_selection_grouped) ? margin.top : Math.min(sy,my),
max_y = (__data_selection_grouped) ? height : Math.max(sy,my) maxY = (__data_selection_grouped) ? height : Math.max(sy,my)
main.select('.dragarea') main.select('.dragarea')
.attr('x', min_x) .attr('x', minX)
.attr('y', min_y) .attr('y', minY)
.attr('width', max_x-min_x) .attr('width', maxX-minX)
.attr('height', max_y-min_y) .attr('height', maxY-minY)
main.selectAll('.target-circles, .target-bars') main.selectAll('.target-circles, .target-bars')
.selectAll('.target-circle, .target-bar') .selectAll('.target-circle, .target-bar')
.filter(function(d){ return __data_selection_isselectable(d) }) .filter(function(d){ return __data_selection_isselectable(d) })
.each(function(d,i){ .each(function(d,i){
var _this = d3.select(this), var _this = d3.select(this),
_selected = _this.classed('_s_'), isSelected = _this.classed('_s_'),
_included = _this.classed('_i_'), isIncluded = _this.classed('_i_'),
_x, _y, _w, toggle, isWithin = false _x, _y, _w, toggle, isWithin = false
if (this.nodeName === 'circle') { if (this.nodeName === 'circle') {
_x = _this.attr("cx")*1 _x = _this.attr("cx")*1
_y = _this.attr("cy")*1 _y = _this.attr("cy")*1
toggle = togglePoint toggle = togglePoint
isWithin = min_x < _x && _x < max_x && min_y < _y && _y < max_y isWithin = minX < _x && _x < maxX && minY < _y && _y < maxY
} }
else if (this.nodeName === 'rect') { else if (this.nodeName === 'rect') {
_x = _this.attr("x")*1 _x = _this.attr("x")*1
_y = _this.attr("y")*1 _y = _this.attr("y")*1
_w = _this.attr('width')*1 _w = _this.attr('width')*1
toggle = toggleBar toggle = toggleBar
isWithin = min_x < _x+_w && _x < max_x && _y < max_y isWithin = minX < _x+_w && _x < maxX && _y < maxY
} }
if (isWithin ^ _included) { if (isWithin ^ isIncluded) {
_this.classed('_i_', !_included) _this.classed('_i_', !isIncluded)
// TODO: included/unincluded callback here // TODO: included/unincluded callback here
_this.classed('_s_', !_selected) _this.classed('_s_', !isSelected)
toggle(!_selected, _this, d, i) toggle(!isSelected, _this, d, i)
} }
}) })
}) })
......
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