venkat6 / o3d

Automatically exported from code.google.com/p/o3d
0 stars 0 forks source link

Canvas texture draw sample only draws along top edge of red rectangle. #175

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open samples/canvas-texturedraw.html
2. Try to draw by clicking in red rect.
3. Notice that it only draws if you move the mouse along the top edge
   of the rectangle.

What is the expected output? What do you see instead?
You should be able to draw all over.

This happens in all browsers.

Original issue reported on code.google.com by gspen...@google.com on 12 Oct 2009 at 3:35

GoogleCodeExporter commented 8 years ago
Modify lines from 125 to 133 as below will fix the problem

// Note that the coordinates passed to drawBitmap get scaled by the current
    // canvas drawing matrix and therefore we adjust them by the scale to get
    // the bitmap to follow the mouse position.
    g_canvasQuad.canvas.drawBitmap(
        g_brushTexture,
        (offset.x / brushScale - g_brushTexture.width * 0.5),
        ((g_canvasHeight - offset.y) / brushScale + g_brushTexture.height * 0.5 -
g_canvasHeight));
    g_canvasQuad.canvas.restoreMatrix();
    g_canvasQuad.updateTexture();

Original comment by CKYun...@gmail.com on 22 Mar 2010 at 4:28