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
26.04.12, 16:05
19.04.12, 16:54
07.04.12, 16:17
05.04.12, 00:49
15.03.12, 13:02
14.02.12, 19:00
Posts
21.05.12, 22:40
20.05.12, 20:22
19.05.12, 21:38
19.05.12, 13:43
15.05.12, 02:38
15.05.12, 01:51
Script of the Moment
Cross Hatch Raster 15.03.12
Donation

If you use Scriptographer regularly or for commercial purposes, please consider making a donation via PayPal:

Thank you!