Unable to return ref point using linkConnectionPoint function - jointjs

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.

Related

Godot, GDScript - Play Animation on Right Click

Any insight onto why this code doesn't work?
When I right click, the game crashes and gives the error: "Invalid call. Nonexistent function 'play' in base 'Array'".
func _ready():
anim_Play = get_tree().get_nodes_in_group("AnimationPlayer")
func_input(event):
if Input.is_action_pressed("aim"):
anim_Play.play("AimSights")
I guess from your code that you are trying to get a reference to your AnimationPlayer node, it fails and you get an Array instead.
It happens because you are using get_nodes_in_group (which returns an Array of nodes in a group), instead of get_node, which returns a node.
Invalid call. Nonexistent function 'play' in base 'Array
Means your are trying the call the play method (found in AnimationPlayer) from an Array object, that does not exist.
You would get AnimationPlayer like
var anim_Play = get_node("./path/to/your/AnimationPlayer")
Response to your question
get_nodes_in_group(group) returns an Array of nodes that are both in the SceneTree and in group group.
Let's say there is one AnimationPlayer node in the group "AnimationPlayer". We'll fetch it like:
var anim_player = get_tree().get_nodes_in_group("AnimationPlayer")[0]
Notice the [0]. That is called an accessor. We access the array at element 0. Now, we can call play:
anim_player.play("AimSights")
Do note: it is an error to access a non-existent element of an array.
Recommendation
This seems like an inappropriate use of groups. I recommend you use a node path, like svarog suggested, if the animation player is in the same scene as the script.
Additionally, it will help to read or google about some fundamental programming concepts: specifically Objects and Arrays.
Lastly, read over the scenes and nodes page from Godot's documentation: https://docs.godotengine.org/en/3.1/getting_started/step_by_step/scenes_and_nodes.html
The whole getting started guide on the Godot's documentation is an invaluable resource for learning Godot. It will help you greatly and it's not too long of a read.
Good luck!

How do I add button in NetSuite client script and use it as trigger for script function?

I'm trying to add a button to the current record with the Client Script button definition on a script record, but for some reason it's not finding my function. I'm returning my function tryThisand there is a button on the page which I created on the script record with the function tryThis defined in the appropriate field, but the code doesn't run. Here's my script:
define (['N/currentRecord','N/search','N/record'] ,
function(currentRecord,search,record) {
function tryThis(context){
log.debug({
title: 'try this',
details: 'try this'
});
}
function pageInit(context) {
}
return {
pageInit: pageInit,
tryThis: tryThis
};
});
Nothing happens :(
Yes, the script is deployed.
How can I use this button on a client script??
This doesn't exactly answer your question directly, but I hope it may help. I tested this, and there appears to be nothing wrong with the way you've set it up - the only thing that seems to be not working is the log module, which I've come across before in client scripts.
Try running your function using a console.log() or alert() instead (both work for me).
Hopefully someone with more detailed knowledge of the N/log module's design and behavior will chip in, as the documentation seems to indicate that this should work.
At the bottom of your Client Script record in Edit mode you will find where you can easily set the button and function to call.

Callback function for Fabric.js renderAll method?

I'm using Fabric.js and need to call a function after renderAll has fully completed. This seems like simple functionality that would exist, but my searches, documentation reading, etc. has come up empty. If anyone has a solution, I'd greatly appreciate it.
canvas.deactivateAll().renderAll();
// I need a save function called here, after the above has completed
I've tried binding to the after:render method of the canvas, but that gets called with each object, rather than all objects.
canvas.on('after:render', function() {
// call the save function here
});
I suppose what I could do is count the number of canvas objects, then increment a counter on the after:render method, then check to see if the counter === the number of objects, and if it does, then call the save function. That seems rather convoluted to me though.
(As more background, in case there is another way to achieve what I need, I need to save a canvas image, but first need to deselect all objects so the image isn't saved with the handles showing.)
I found a solution using the deactivateAllWithDispatch method, which fires the selection:cleared listener event. In that event function, I'm executing the deactivateCallback method if it's set.
canvas.on('selection:cleared', function() {
if (deactivateCallback) {
executeCallbackFunction(renderCallback, window);
deactivateCallback = null;
}
});
deactivateCallback = callback;
canvas.deactivateAllWithDispatch();
(note: the executeCallbackFunction in the above code isn't directly related to the answer, and just executes a function that has been passed in as a string)
So what you need is to deactivate all elements. I don't know why canvas.deactivateAll() isn't ok. Does this jsFiddle help you.

Netsuite: ReferenceError functionName is not defined

This is probably a stupid one but I have tried all the things I can think of. I am currently getting the below error on my client side script when I try and execute it.
Error: ReferenceError acvt_serialNumber_saveRecord is not defined
On the Script record in Netsuite I have set the saveRecord function as follows:
acvt_serialNumber_saveRecord
The code in the file is:
function acvt_serialNumber_saveRecord(){
/**do stuff */
}
I have reuploaded to code to make sure the right version was in NetSuite. I have added one character to both the script fn name and the fn name on the Script record (as a shot in the dark). I have seen in the Javascript console at runtime that the correct code is in there and I can see the exact function name (I did a ctrl+f for the "undefined" function in the code in the console to make sure spelling was all the same).
NOTHING has worked. I had this code working earlier, but the changes I made were not to this function at all.
Any help is appreciated
Another thing to check is the code that you recently changed. In particular, check for a hanging comma. IE:
var someObj = {
someProp:'somevalue',
};
The comma at the end of 'somevalue' will cause the script to fail, throwing 'undefined' errors.
Have you tried deleting the Script record in NetSuite and re-creating it?
Do you have any library included for that Client Script in netsuite ?
Provide a screen shot of your Netsuite script page
I encounter similar problem like this before, but it was because i called a function which is inside a library file
Thanks

Guide.ShowSignIn(1, false) Value not in range exception

In a new Xna game I wroted this:
GamerServicesComponent gsc = new GamerServicesComponent(this);
gsc.Initialize();
Components.Add(gsc);
if(!GamerServicesDispatcher.IsInitialized)
GamerServicesDispatcher.Initialize(Services);
And in the Update method
if (Keyboard.GetState().IsKeyDown(Keys.S))
if (!Guide.IsVisible)
Guide.ShowSignIn(1, false); // true doesn't solve it nor 2 or 4 as paneCount
I'm receiving a
Value does not fall within the expected range.
Anybody?
It seems that Guide.ShowSignIn() can't be used anymore. I Don't know the reason nor if it is really true. But I couldn't get it working with ShowSignIn.
The way I had to login was by pressing the Home button.
The Guide will appear and you can simply follow the Guide to login.
Waiting a few frames before calling Guide.ShowSignIn() works for me. I don't call it until my game has loaded all assets and at least I frame has been rendered.

Resources