I would like to detect when an element released over a link.
Thank you for your help.
example
Use paper triggered events.
paper.on('cell:pointerup', function(evt, x, y) {
})
cell:pointerup or cell:mouseout will work for your requirement.
Check this tutorial http://jointjs.com/api#joint.dia.Paper:events
Related
What i am trying to accomplish is to have a user click on the canvas and the sprite(player) will move to that location and STOP once it reaches that location.
Currently i have the player can click and it will continue in that path which is the default function.
update: function() {
this.player.rotation = this.game.physics.arcade.angleToPointer(this.player);
if (this.game.input.activePointer.justPressed()) {
// move on the direction of input
this.game.physics.arcade.moveToPointer(this.player, this.playerSpeed);
}
}
Maybe its simpler than i think but i cant seem to find a solution.
point in the right direction would be useful :)
I think you look for something like this:
Using Tweens (something very interesting about Phaser)
OR
Using
Arcade Physics (which is an example similar to yours)
I created a rect element with magnet property set to true. When I try to connect a link to the element, it gets connected to a point on the perimeter of the rectangle.
Then, I tried using linkConnectionPoint function as defined in the following code snippet:
linkConnectionPoint
But, the function is not been executed anytime I create a new link.
Is there any issue in the way of defining the function?
Any help is highly appreciated.
Please read source code.
https://github.com/clientIO/joint/blob/master/src/joint.dia.link.js#L1250
if joint.dia.Paper.perpendicularLinks is true, then never use linkConnectionPoint option...
so, please set 'perpendicularLinks' to false.
So, Brad Larson is awesome. I'm using his GPUImage library since he optimized the CGContextCreateImage for video output to instead render straight into OpenGL. Then he rewrote it to be even more amazing, and half the questions are outdated. The other half have the new callbacks, Like this question, but for the life of me, I can't get the video frames callback to not be nil. (the CMSampleBuffer to CIImage functions)
I know I have to "tag the next frame" to be kept in memory, thanks to his blog. I also know I process it (but GPUImageVideo also does that), then I grab from the framebuffer. Still nill.
The capture command that's supposed to auto-filter it into a CGImage, from the CGImagePicture's processImageUpToFilter function seems to be what I want, and I've seen it mentioned, but I am lost as to how to hook up the output to its frameBuffer.
Or should I use GPUImageRawDataOutput, and how to hook up? I've been copying and pasting, editing, experimenting, but unsure if it's just the fact I don't know openGL enough to hook up the right stuff or?
Any help is appreciated. I wouldn't ask, since so many related questions are up here, but I use them and still get nil on the output.
Here is my current try:
func willOutputSampleBuffer(sampleBuffer: CMSampleBuffer!) {
gpuImageVideoCamera.useNextFrameForImageCapture()
//Next line seems like a waste, as this func is called in GPUImageVideoCamera already.
gpuImageVideoCamera.processVideoSampleBuffer(sampleBuffer);
if let image = gpuImageVideoCamera.imageFromCurrentFramebuffer()
{
//it's nil
}
}
It seems to use the filter instead, and useNextFrame should be AFTER processing to not go super-slow.
Inside of willOutputSampleBuffer, this is it.
if let image = transformFilter.imageFromCurrentFramebuffer()
{
// image not nil now.
}
transformFilter.useNextFrameForImageCapture(); //enusre this comes after
This has given us stunning speeds that beat Google's p2p library. Brad, thanks, everyone should support your efforts.
According to the documentation linked from the Intern Git project (https://github.com/admc/wd/blob/master/doc/api.md) it should be possible to use active() to obtain the active element on the page...
However, when I use this I don't see my callback or fired or get any output, e.g...
.keys(specialKeys.Tab)
.sleep(1000)
.active(function(err, element) {
console.log("Active Element is: ", err, element);
})
However I'm not seeing any output at all, nor any error conditions... I am however seeing the tab event occurring. Any ideas on what I'm doing wrong here?
Many thanks.
The functional API in Intern is Promise-based, so you don’t pass callbacks into any of the methods except for then, otherwise, or always. Step 4 of the Intern tutorial describes this in more detail. Your code would be:
.keys(specialKeys.Tab)
.sleep(1000)
.active()
.then(function(element) {
console.log("Active Element is: ", element);
})
Can any one point out as where can I get some tutorials about IronJS and how to call a method written in IronJS from C# 4.0
Thanks
C#4.0, IronJS
There is now some good information from the author on the GitHub project wiki:
https://github.com/fholm/IronJS/wiki
There is a 'first steps' blog post here:
http://blog.dotsmart.net/2011/04/20/first-steps-with-ironjs-0-2/
And I have written several blog posts on IronJS including one that stej has linked. The post stej linked is actually current, but it only covers some basic aspects of embedding. IronJS has undergone a radical rewrite since my first posts so I have put notices on those posts directing to newer updates.
This post specifically covers the original poster's question about how to call JS code from C#:
http://newcome.wordpress.com/2011/03/13/embedding-ironjs-part-ii/
Here is a quick summary:
IronJS.Hosting.Context ctx = IronJS.Hosting.Context.Create();
ctx.Execute("hello = function() { return 'hello from IronJS' }");
IronJS.Box obj = ctx.GetGlobal("hello");
Func<IronJS.Function,IronJS.Object,IronJS.Box> fun =
obj.Func.Compiler.compileAs<Func<IronJS.Function,IronJS.Object,IronJS.Box>>(obj.Func);
IronJS.Box res = fun.Invoke(obj.Func, obj.Func.Env.Globals);
Console.WriteLine( res.String );
Checkout https://github.com/fholm/IronJS/wiki for guides on using IronJS
If you have a Context, you can call Context.CompileSource() and pass its results to Context.InvokeCompiled(), or just call Context.Execute() and pass it the source code. Roughly, this:
IronJS.Hosting.Context ijsCtx;
ijsCtx = IronJS.Hosting.Context.Create();
ijsCtx.Execute("(function(){return 42;})()");
You might have a look at Embedding IronJs. But it looks outdated as well as the answer by #Gabe.
Currently it should be called like this:
var o = new IronJS.Hosting.Csharp.Context
o.Execute('var a = 10; a');