Sg2.9
HitTest Object Example?
Recent RSS
HitTest Object Example?
From:  Bjorn
Date:  22. August 2007, 17:52

I'm interested in modifying bubble bubbling to generate non-overlapping objects and I'm having difficulty with the HitTest - I haven't been able to find a script yet that uses this and the documentation is a bit sparse.

Any example would be great.

Re: HitTest Object Example?
From:  Keegan Green
Date:  23. August 2007, 02:58

I was also wondering how to use HitTest for a script I am planning to make. For my purposes, I would like to know the point were 2 lines cross.

I would also love to see an example if anyone has one.

Re: HitTest Object Example?
From:  ken frederick
Date:  19. March 2009, 00:42

i know this thread is amazingly old and that there's a lot of inactvity on this board, but i found this illustrator java example that might offer some insight into this

http://park12.wakwak.com/~shp/lc/et/en_aics_script.html#merge

Ken

Re: HitTest Object Example?
From:  Hiroyuki Sato
Date:  8. June 2009, 00:15

Hi
Here is an example.

function onMouseDrag(event) {
  var radius = Math.random() * 10 + 10;
  var ht = activeDocument.hitTest(event.point, HitTest.TEST_PATHS, radius);
  if(ht == null){
    activeDocument.createCircle(event.point, radius);
  } else {
    // Dialog.alert(ht);         // shows its elements
    // var target = ht.getArt(); // gets the path which hit
  }
}

As far as I know
1. Tolerance unit is pixel. it depends on the current zoom factor.
2. Tested area is a rectangle. not a circle.

Path.hitTest() has an argument called "epsilon". I don't know what it is.

> Ken
It's my page! Thanks. But it dosn't use hitTest function.

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Sudoku Generator + Solver 03.01.13