Results 1 to 2 of 2

Thread: isPointInPath doesn't work most of the time.

  1. #1
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Duluth, MN
    Posts
    153
    Answers
    3
    Vote Rating
    23
      0  

    Default isPointInPath doesn't work most of the time.

    It appears that isPointInPath doesn't work with circles or other paths many times for some reason.

    Try this in the live preview pane on the circle documentation.

    Code:
    var x = new Ext.draw.Component({
      fullscreen: true,
      items: []
    });
    var y = x.getSurface().add({
        type: 'circle',
        cx: 100,
        cy: 100,
        r: 25,
        fillStyle: 'blue'
      });
      x.element.on('mousemove', function(e){
          if (y.attr.path.isPointInPath(e.pageX, e.pageY)){
            console.log(e);
         console.log(y.attr.path.isPointInPath(e.pageX, e.pageY));
          }
        
    });
    x.renderFrame();
    you'll see that no matter where you put the cursor, isPointInPath is never true.

    Changing to

    Code:
    var x = new Ext.draw.Component({  fullscreen: true,
      items: []
    });
    var y = x.getSurface().add(
    {
        type: 'path',
        path: 'M75,75 c0,-25 50,25 50,0 c0,-25 -50,25 -50,0',
        fillStyle: 'blue'
      });
      x.element.on('mousemove', function(e){
          if (y.attr.path.isPointInPath(e.pageX, e.pageY)){
            console.log(e);
         console.log(y.attr.path.isPointInPath(e.pageX, e.pageY));
          }
        
    });
    x.renderFrame();
    Throws this error:
    Uncaught TypeError: Object function (w){return((s*w+r)*w+p)*w+o} has no method 'cubicRoot'

    I actually also get this error when using a circle too in my program, I can't recreate that error with a circle here though.

    Any Ideas?

    Thanks
    Bob

  2. #2
    Sencha User
    Join Date
    Jan 2013
    Posts
    1
    Vote Rating
    0
      0  

    Default Was it resolved

    I have the same issue of isPointInPath being inaccurate and generating

    Uncaught TypeError: Object function (t) {
    return ((a * t + b) * t + c) * t + d;
    } has no method 'cubicRoot'


    Were you able to make it work?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •