You are reading a single comment by @gerardwr and its replies. Click here to read the full conversation.
  • Hmmmmmm, major error on my part :-(

    My code from the emulator:

    g.clear();
    
    // fill screen with green
    g.setColor(0,1,0);  // green
    g.fillRect(0,0,239,239);
    
    // reset getModified area
    m=g.getModified(true);
    
    print(m);
    
    g.setColor(1,0,0);  // red
    
    // g.fillRect(100,100,120,120);
    
    m=g.getModified();
    
    print(m);
    
    g.clearRect(m.x1,m.y1,m.x2,m.y2);
    

    Output is:

    >{ "x1": 0, "y1": 0, "x2": 239, "y2": 239 }
    >undefined
    >Uncaught Error: Cannot read property 'x1' of undefined
     at line 20 col 14
    g.clearRect(m.x1,m.y1,m.x2,m.y2);
                 ^
    >
    

    I see now dat getModified(true) returns an undefined. I was completely mislead by the response >{ "x1": 0, "y1": 0, "x2": 239, "y2": 239 } and assumed that this was the area that was set.

    Apologies for wasting your time (red face), appreciate the help.

About

Avatar for gerardwr @gerardwr started