Loading ...
Sorry, an error occurred while loading the content.

Opera and rotate

Expand Messages
  • Richard Heyes
    Hi, Has anyone had any problem with using the rotate() method in conjunction with Opera? Eg: http://dev.rgraph.org/trash/tradar.html Works fine in Firefox,
    Message 1 of 4 , Dec 5, 2008
    • 0 Attachment
      Hi,

      Has anyone had any problem with using the rotate() method in
      conjunction with Opera?

      Eg: http://dev.rgraph.org/trash/tradar.html

      Works fine in Firefox, Chrome and Safari, but not Opera. Cheers.

      --
      Richard Heyes

      HTML5 Graphing for FF, Chrome, Opera and Safari:
      http://www.rgraph.org (Updated November 29th)
    • Philip Taylor
      ... It looks like the problem you re experiencing is that Opera applies transforms to paths when it s stroking/filling them, not when you re constructing the
      Message 2 of 4 , Dec 5, 2008
      • 0 Attachment
        On Fri, Dec 5, 2008 at 11:45 AM, Richard Heyes <richard.heyes@...> wrote:
        > Hi,
        >
        > Has anyone had any problem with using the rotate() method in
        > conjunction with Opera?
        >
        > Eg: http://dev.rgraph.org/trash/tradar.html
        >
        > Works fine in Firefox, Chrome and Safari, but not Opera. Cheers.

        It looks like the problem you're experiencing is that Opera applies
        transforms to paths when it's stroking/filling them, not when you're
        constructing the path. So "rotate(); lineTo(); stroke()" is equivalent
        (in Opera, not other browsers) to "lineTo(...); rotate(...);
        stroke()". That means you can't do "lineTo(); rotate(); lineTo(); ...;
        stroke()", because both lines get rotated by exactly the same amount.

        (Opera's behaviour used to match the HTML5 canvas specification, but
        then the spec changed to match what other browsers did, and Opera
        hasn't been fixed yet.)

        To make it work in all browsers, you'll probably have to not use
        rotate() and instead do the trigonometry manually. I think it should
        work if you change the "Thi bit draws the graph" loop to something
        like:

        for (i in this.data) {
        /* ... same as before, then: */

        var angle = RGraph.degrees2Radians(360 / this.data.length) * i;
        if (i == 0) {
        this.context.moveTo(xPos*Math.cos(angle), xPos*Math.sin(angle));
        } else {
        this.context.lineTo(xPos*Math.cos(angle), xPos*Math.sin(angle));
        }
        }

        --
        Philip Taylor
        excors@...
      • Erik Dahlström
        ... Seems to work just fine in Opera 10. Cheers /Erik -- Erik Dahlstrom, Core Technology Developer, Opera Software Co-Chair, W3C SVG Working Group Personal
        Message 3 of 4 , Dec 5, 2008
        • 0 Attachment
          On Fri, 05 Dec 2008 12:45:34 +0100, Richard Heyes <richard.heyes@...> wrote:

          > Hi,
          >
          > Has anyone had any problem with using the rotate() method in
          > conjunction with Opera?
          >
          > Eg: http://dev.rgraph.org/trash/tradar.html
          >
          > Works fine in Firefox, Chrome and Safari, but not Opera. Cheers.

          Seems to work just fine in Opera 10.

          Cheers
          /Erik

          --
          Erik Dahlstrom, Core Technology Developer, Opera Software
          Co-Chair, W3C SVG Working Group
          Personal blog: http://my.opera.com/macdev_ed
        • Richard Heyes
          ... Hi, Really? I only have Opera 9.6 installed. I think I ll wait for this then instead of hacking (or fumbling...) around. Thanks Eric and Philip. -- Richard
          Message 4 of 4 , Dec 5, 2008
          • 0 Attachment
            > Seems to work just fine in Opera 10.

            Hi,

            Really? I only have Opera 9.6 installed. I think I'll wait for this
            then instead of hacking (or fumbling...) around. Thanks Eric and
            Philip.

            --
            Richard Heyes

            HTML5 Graphing for FF, Chrome, Opera and Safari:
            http://www.rgraph.org (Updated December 5th)
          Your message has been successfully submitted and would be delivered to recipients shortly.