From apalomba at austin.rr.com Wed Apr 9 16:27:59 2008 From: apalomba at austin.rr.com (Anthony Palomba) Date: Wed Apr 9 16:28:03 2008 Subject: [javascript-dev] Hit test for Sketch objects... Message-ID: <21612.47fd42ef@www.cycling74.com> I would like to create an interface that has objects (spheres) that I can click on. With screentoworld() I can convert the mouse click point to world coordinates. The question is how can I test to see if my world coordinates are in a drawn object? From jules.rawlinson at gmail.com Thu Apr 10 06:11:49 2008 From: jules.rawlinson at gmail.com (Jules Rawlinson) Date: Thu Apr 10 06:11:55 2008 Subject: [javascript-dev] Re: Hit test for Sketch objects... In-Reply-To: <21612.47fd42ef@www.cycling74.com> Message-ID: <21640.47fe0404@www.cycling74.com> Hi Anthony Funnily enough I've been revisiting my xy_lcd patches that you were so kind about quite some time ago. I've rebuilt the pseudogravity patch using jitter objects and javascript. The js includes some routines for hit detection per object, it needs to be updated to use pythagoras theorem to better detect hit inside a circle... The attached file might help you get started Cheers Jules PS I guess you've seen 47jJitterListener.pat in the jitter tutorials. -- http://www.pixelmechanics.com http://ddm.caad.ed.ac.uk -------------- next part -------------- A non-text attachment was scrubbed... Name: jr.gl.gravity.zip Type: application/zip Size: 8353 bytes Desc: not available Url : http://www.cycling74.com/pipermail/javascript-dev/attachments/20080410/6e9d9482/jr.gl.gravity.zip From apalomba at austin.rr.com Thu Apr 10 09:10:23 2008 From: apalomba at austin.rr.com (Anthony Palomba) Date: Thu Apr 10 09:10:29 2008 Subject: [javascript-dev] Re: Hit test for Sketch objects... In-Reply-To: <21640.47fe0404@www.cycling74.com> Message-ID: <21657.47fe2ddf@www.cycling74.com> Thanks Jules, I will take a look at it. From o at borgen.as Fri Apr 11 03:22:39 2008 From: o at borgen.as (Lut Lei) Date: Fri Apr 11 03:22:43 2008 Subject: [javascript-dev] Dumping an image from jit.sketch to a matrix? Message-ID: <216a4.47ff2dde@www.cycling74.com> Hello list I've been looking a bit on the jsui_spherepen-example, which can be found in the folder ...MaxMSP/examples/javascript/ui Could someone please help me find a way for dumping a finnished drawing out to a jit.matrix for further processing, like a "dump"-method or something? Any help will be appreciated. From oli_larkin at yahoo.co.uk Fri Apr 11 09:05:49 2008 From: oli_larkin at yahoo.co.uk (Oliver Larkin) Date: Fri Apr 11 09:05:52 2008 Subject: [javascript-dev] Re: Hit test for Sketch objects... In-Reply-To: <21612.47fd42ef@www.cycling74.com> Message-ID: <216d6.47ff7e4c@www.cycling74.com> have a look at i_ispace.js in the int.lib source, which does just this oli -- original plugins and stuff for max: www.olilarkin.co.uk From apalomba at austin.rr.com Fri Apr 11 09:35:48 2008 From: apalomba at austin.rr.com (Anthony Palomba) Date: Fri Apr 11 09:35:52 2008 Subject: [javascript-dev] Re: Hit test for Sketch objects... In-Reply-To: <216d6.47ff7e4c@www.cycling74.com> Message-ID: <216de.47ff8553@www.cycling74.com> Actually I did look at your source. You are using "jit.gl.render". I am familiar with doing hit detection using jitter. I am using the jsui sketch object. I believe (as far as I know) jsui sketch does not support JitterListener events. Someone please correct me if I am wrong... From sasha at mortalspaces.com Fri Apr 11 13:17:53 2008 From: sasha at mortalspaces.com (Sasha Harris-Cronin) Date: Fri Apr 11 13:18:01 2008 Subject: [javascript-dev] String declaration and opening Files Message-ID: <216f7.47ffb961@www.cycling74.com> I ran into an interesting mac javascript feature yesterday. I found the workaround, but thought I'd mention it. Basically, initializing a String at declaration will interfere with testing for a file with the same name as that string. Or, more verbosely, the following function will always report that the file with the filename passed to it exists, even if the file does not. function checkForFile(fileName) //check to see if file exists { var s = new String(fileName); f = new File(s, "read"); if (f.isopen) //if succeed in opening file { f.close(); post("found file: " + fileName + " "); return (true); } else //file doesn't exist { f.close(); //anal retentively close file post("could not find file: " + fileName + " "); return (false); } } If I change the string declaration to be like this, however: var s = new String(); s = filename; Then it works fine. Don't pick on programming style, by the way. I know that it is fully unnecessary to declare s in the first place. This was just a concise example. It is not specific to a local function either. If a string is declared with that text outside of the function, the function still misreports the file. String is obviously part of javascript 1.5, but File IO is a max/msp add. I'm curious about what's going on under the hood to make that happen. sasha -- --- sasha harris-cronin ---- -- sasha@mortalspaces.com -- --- www.mortalspaces.com --- From videomasta at web.de Sat Apr 12 08:11:28 2008 From: videomasta at web.de (videomasta) Date: Sat Apr 12 08:11:31 2008 Subject: [javascript-dev] Re: BUG: javascript can't handle large pattrstorage clientlist when overdrive is enabled In-Reply-To: <20f08.47e8a161@www.cycling74.com> Message-ID: <21730.4800c310@www.cycling74.com> i had the same problem. the solution was to set the immediate property for the function: in your case: anything.immediate = 1; i think that this is a bug not a feature ! From adamjmurray at gmail.com Sat Apr 12 12:03:30 2008 From: adamjmurray at gmail.com (Adam Murray) Date: Sat Apr 12 12:03:34 2008 Subject: [javascript-dev] Re: BUG: javascript can't handle large pattrstorage clientlist when overdrive is enabled In-Reply-To: <21730.4800c310@www.cycling74.com> Message-ID: <2173b.4800f972@www.cycling74.com> Quote: videomasta wrote on Sat, 12 April 2008 07:11 ---------------------------------------------------- > i had the same problem. > the solution was to set the immediate property > for the function: > > in your case: > > anything.immediate = 1; Cool. That works. Thanks! -- Adam Murray compusition.com From o at borgen.as Mon Apr 14 13:35:09 2008 From: o at borgen.as (Lut Lei) Date: Mon Apr 14 13:35:18 2008 Subject: [javascript-dev] Re: Dumping an image from jit.sketch to a matrix? In-Reply-To: <216a4.47ff2dde@www.cycling74.com> Message-ID: <217f7.4803b1ed@www.cycling74.com> Sorry to bump this, but after having a look at the jsui_imagestuff-example I've managed to incorporate two methods which transform the drawing into a texture. And that's progress;) But eventually I want to save the drawing to disk using a jit.matrix, or through one of the quicktime objects. How do I get the texture out of the JSUI object, as a matrix? Anyone's got a hint? From jkc at musork.com Tue Apr 15 14:44:56 2008 From: jkc at musork.com (Joshua Kit Clayton) Date: Tue Apr 15 14:45:06 2008 Subject: [javascript-dev] Re: Dumping an image from jit.sketch to a matrix? In-Reply-To: <217f7.4803b1ed@www.cycling74.com> References: <217f7.4803b1ed@www.cycling74.com> Message-ID: On Apr 14, 2008, at 12:35 PM, Lut Lei wrote: > > But eventually I want to save the drawing to disk using a > jit.matrix, or through one of the quicktime objects. How do I get > the texture out of the JSUI object, as a matrix? Anyone's got a hint? See jsui_matriximage-example.pat -Joshua From pnyboer at slambassador.com Tue Apr 15 15:11:01 2008 From: pnyboer at slambassador.com (pnyboer) Date: Tue Apr 15 15:11:04 2008 Subject: [javascript-dev] mouseover zone detection Message-ID: <21860.480519e5@www.cycling74.com> Below is a patch and JS that does mouseover zone detection. If you are over a certain region, it will output some info. I'm wondering if there's a more elegant way to do this; I''m using a lot of "ifs" to test the coordinates, and it seems a pretty unweildly way to go. Is there a clever way of doing this? (the zones are irregular) /* BEGIN JAVASCRIPT buttongrid.js */ //detect where the mouse is hovering and if it's in a relevant zone, output some info about that zone. autowatch = 1; var Btn0 = [ 0 , 0 , 48 , 48 ] ; var Btn1 = [ 80 ,41 , 113 , 74 ] ; var Btn2 = [ 98 ,97 , 177 ,176 ] ; var Btn3 = [ 162 , 8 , 189 , 35 ] ; var Btn4 = [ 207 ,40 , 273 , 106 ] ; var Btn5 = [ 303 ,110 , 326 , 133 ] ; var thebutton = -1; var thebuttonchange = 0; function mouse(x,y){ if(x>Btn0[0] && xBtn0[1] && yBtn1[0] && xBtn1[1] && yBtn2[0] && xBtn2[1] && yBtn3[0] && xBtn3[1] && yBtn4[0] && xBtn4[1] && yBtn5[0] && xBtn5[1] && y