(dx, dy)
| 113 | } |
| 114 | |
| 115 | function moveVertexController(dx, dy) { |
| 116 | if(!polygons.length) return; |
| 117 | |
| 118 | var x0 = copyPolygons[indexI][indexJ][1]; |
| 119 | var y0 = copyPolygons[indexI][indexJ][2]; |
| 120 | |
| 121 | var cell = polygons[indexI]; |
| 122 | var len = cell.length; |
| 123 | if(pointsOnRectangle(cell)) { |
| 124 | var _dx = dx; |
| 125 | var _dy = dy; |
| 126 | if(dragOptions.isActiveSelection) { |
| 127 | // handle an edge contoller for rect selections |
| 128 | var nextPoint = getNextPoint(cell, indexJ); |
| 129 | if(nextPoint[1] === cell[indexJ][1]) { // a vertical edge |
| 130 | _dy = 0; |
| 131 | } else { // a horizontal edge |
| 132 | _dx = 0; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | for(var q = 0; q < len; q++) { |
| 137 | if(q === indexJ) continue; |
| 138 | |
| 139 | // move other corners of rectangle |
| 140 | var pos = cell[q]; |
| 141 | |
| 142 | if(pos[1] === cell[indexJ][1]) { |
| 143 | pos[1] = x0 + _dx; |
| 144 | } |
| 145 | |
| 146 | if(pos[2] === cell[indexJ][2]) { |
| 147 | pos[2] = y0 + _dy; |
| 148 | } |
| 149 | } |
| 150 | // move the corner |
| 151 | cell[indexJ][1] = x0 + _dx; |
| 152 | cell[indexJ][2] = y0 + _dy; |
| 153 | |
| 154 | if(!pointsOnRectangle(cell)) { |
| 155 | // reject result to rectangles with ensure areas |
| 156 | for(var j = 0; j < len; j++) { |
| 157 | for(var k = 0; k < cell[j].length; k++) { |
| 158 | cell[j][k] = copyPolygons[indexI][j][k]; |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | } else { // other polylines |
| 163 | cell[indexJ][1] = x0 + dx; |
| 164 | cell[indexJ][2] = y0 + dy; |
| 165 | } |
| 166 | |
| 167 | redraw(); |
| 168 | } |
| 169 | |
| 170 | function endDragVertexController() { |
| 171 | update(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…