Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
clearRect
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nicolas Garcia Belmonte  
View profile  
(1 user)  More options Apr 20 2008, 5:39 pm
From: Nicolas Garcia Belmonte <phil...@gmail.com>
Date: Sun, 20 Apr 2008 14:39:05 -0700 (PDT)
Local: Sun, Apr 20 2008 5:39 pm
Subject: clearRect
Hi, I'm having some troubles with the clear rectangle (clearRect)
method in excanvas.
It seems that "clearRect" just clears all the canvas background
instead of just clearing the zone specified by the coordinates.
Do you have some information about this or a useful workaround?

Thanks.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Arvidsson  
View profile  
(1 user)  More options Apr 21 2008, 12:30 pm
From: "Erik Arvidsson" <erik.arvids...@gmail.com>
Date: Mon, 21 Apr 2008 09:30:31 -0700
Local: Mon, Apr 21 2008 12:30 pm
Subject: Re: clearRect
Yes, clearRect is not implemented.  We always clear the entire canvas,
which is a common usecase.  Clearing a rectangle requires clipping
paths or some other mechanism and I don't think VML gives us that
power.

On Sun, Apr 20, 2008 at 14:39, Nicolas Garcia Belmonte

<phil...@gmail.com> wrote:

>  Hi, I'm having some troubles with the clear rectangle (clearRect)
>  method in excanvas.
>  It seems that "clearRect" just clears all the canvas background
>  instead of just clearing the zone specified by the coordinates.
>  Do you have some information about this or a useful workaround?

>  Thanks.

--
erik

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tcole6  
View profile  
 More options Jun 11 2008, 11:34 am
From: tcole6 <tco...@gmail.com>
Date: Wed, 11 Jun 2008 08:34:07 -0700 (PDT)
Local: Wed, Jun 11 2008 11:34 am
Subject: Re: clearRect
No idea if this affects any other part of the code, but it works for
me and has presented me with no problems.

Simply replace the existing clearRect function with this:

  contextPrototype.clearRect = function(x, y, width, height) {
    if (x >= 0 && y >= 0 && width>= 0 && height >= 0) {
            for (var i = 0; i < this.element_.childNodes.length; i++) {
                var shape = this.element_.childNodes[i];
                if (shape.offsetLeft >= x && shape.offsetTop >= y &&
(shape.offsetLeft + shape.offsetWidth) <= (x + width) &&
(shape.offsetTop + shape.offsetHeight) <= (y + height)) {
                        this.element_.removeChild(shape);
                        i--;
                }
            }
        }
        else {
                alert(x + ", " + y + ", " + width + ", " + height);
        this.element_.innerHTML = "";
        }
    this.currentPath_ = [];
  };

This is rough and dirty and could be optimized, but it's working on my
system. I will try to clean it up and error detect and resubmit later.
Let me know how it works for you.

On Apr 21, 12:30 pm, "Erik Arvidsson" <erik.arvids...@gmail.com>
wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tcole6  
View profile  
 More options Jun 11 2008, 11:38 am
From: tcole6 <tco...@gmail.com>
Date: Wed, 11 Jun 2008 08:38:24 -0700 (PDT)
Local: Wed, Jun 11 2008 11:38 am
Subject: Re: clearRect
Actually I already did a minor change:

  contextPrototype.clearRect = function(x, y, width, height) {
        var x = (x) ? x : 0;
        var y = (y) ? y : 0;
        var width = (width) ? width : canvas.offsetWidth;
        var height = (height) ? height : canvas.offsetHeight;
    for (var i = 0; i < this.element_.childNodes.length; i++) {
        var shape = this.element_.childNodes[i];
        if (shape.offsetLeft >= x && shape.offsetTop >= y &&
(shape.offsetLeft + shape.offsetWidth) <= (x + width) &&
(shape.offsetTop + shape.offsetHeight) <= (y + height)) {
                this.element_.removeChild(shape);
                i--;
        }
    }
    this.currentPath_ = [];
  };

The only issue with this is you may not get a completely "square"
clearing. If a shape does not completely fit within the bounding
ranges, it is left intact. Therefore you may see a slightly non-square
clearing area. Another change to this might experiment with finding
objects that satisfy the x, y option yet fail the width, height option
and therefore remove that element or change it's vml to start outside
the bounding area. I'll work more on it later.

On Jun 11, 11:34 am, tcole6 <tco...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google