void drawTo(int x2, int y2) {
        if (draw_ox == -1) {
            draw_ox = x2;
            draw_oy = y2;
        }
        // need to draw a line from x1,y1 to x2,y2
        if (draw_ox == x2 && draw_oy == y2) {
            dpixels[x2 + rect.width * y2] = 1;
        } else if (CircuitElm.abs(y2 - draw_oy) > CircuitElm.abs(x2 - draw_ox)) {
            // y difference is greater, so we step along y's
            // from min to max y and calculate x for each step
            double sgn = CircuitElm.sign(y2 - draw_oy);
            int x, y;
            for (y = draw_oy; y != y2 + sgn; y += sgn) {
                x = draw_ox + (x2 - draw_ox) * (y - draw_oy) / (y2 - draw_oy);
                dpixels[x + rect.width * y] = 1;
            }
        } else {
            // x difference is greater, so we step along x's
            // from min to max x and calculate y for each step
            double sgn = CircuitElm.sign(x2 - draw_ox);
            int x, y;
            for (x = draw_ox; x != x2 + sgn; x += sgn) {
                y = draw_oy + (y2 - draw_oy) * (x - draw_ox) / (x2 - draw_ox);
                dpixels[x + rect.width * y] = 1;
            }
        }
        draw_ox = x2;
        draw_oy = y2;
    }