-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Support for Resizing Nodes in Editor #70
Comments
It is technically possible, but it will slightly change the format by adding two new node values- width and height |
As long as it wouldn't intervene with YarnSpinner I don't see why not. I do like the idea of having resizing only be possible via one corner 👍 |
I've tried twice to add this feature myself, but can't figure out the GUI side of it. I tried adding the jQuery Resizable thing but failed. I can change the default size of nodes, which helps. Any tips? What widgets/components should this be using? |
Also want to add that this is the only thing that kinda prevents me from embracing Yarn more fully. I yearn to see the full text inside each node. Viewing it as an overview is a lot easier without having to click each node, since my nodes tend to have more text than fits. I just don't understand how existing users can get by seeing a little bit of the text in each node - what are these, nodes for ants? Also on another note I have built a Godot Yarn importer and will be sharing that code on Github in the future. |
@naturally-intelligent if that godot yarn parser works as well as bondage.js , I will make it a priority to add this for you ;) Right now I am working toward implementing it for gdevelop, because it is possible to actually make the yarn editor a part of gdevelop. Include it as part of gdevelop's Ide - that is of course only if I get it to there and the creator of gdevelop approves the pull heheh :) |
Okay, I'll bite! :) Here is the first working version of my Godot Yarn Importer: https://github.com/naturally-intelligent/godot-yarn-importer cheers @blurymind |
@naturally-intelligent All thats left is for someone to implement a usable parser My requirement is for a parser :) |
Okay, I suppose these are Twine rules? Wait - don't answer that because I think we're getting off topic from the issue. Could you please submit this as an issue here: https://github.com/naturally-intelligent/godot-yarn-importer To continue discussion! thanks |
Trying to get this back on topic: I've tried twice to add this feature myself, but can't figure out the GUI side of it. I tried adding the jQuery Resizable thing but failed. I can change the default size of nodes, which helps. Any tips? What widgets/components should this be using? |
So, I've this feature working, but I still have a few bugs to fix before publishing it. And I also have to test it with NWjs (I've been using the electron branch because I'm more familiar with it). |
* Allows node resizing by dragging the bottom right side of a node. It forces it's shape to be a square. I've added this limitation because it would require too much work on the maths of the connection arrows otherwise. * Save to file in json, xml and yarn format. Twine doesn't handle resizing, so the size is not save in the twee and tw2 format. * Loading a file also handle the size if it finds it in json, xml and yarn format. * Had to change a little the math of the arrows because the size was hardcoded. I've tried opening saved files containing the new 'size' option, and old versions of Yarn (the one linked in the build section of the readme) handled it correctly, ignoring the 'size' option and parsing the rest of the file correctly. And old saved files without the new 'size' option are also read correctly, the 'size' option is optional when loading. Note: the dragging box was already here in the html, but it was commented out because it was incomplete. The author who added it was planning to add a 'toggle expand' feature but apparently never did. I reused his 'resize' box and removed the few lines of code related to the 'toggle expand' feature.
@naturally-intelligent Can you give it a try? It's based on the electron branch, because it was easier for me to work on that branch, but porting it to the master branch should be fairly easy and probably won't require a lot of modification. |
* Allows node resizing by dragging the bottom right side of a node. It forces it's shape to be a square. I've added this limitation because it would require too much work on the maths of the connection arrows otherwise. * Save to file in json, xml and yarn format. Twine doesn't handle resizing, so the size is not save in the twee and tw2 format. * Loading a file also handle the size if it finds it in json, xml and yarn format. * Had to change a little the math of the arrows because the size was hardcoded. I've tried opening saved files containing the new 'size' option, and old versions of Yarn (the one linked in the build section of the readme) handled it correctly, ignoring the 'size' option and parsing the rest of the file correctly. And old saved files without the new 'size' option are also read correctly, the 'size' option is optional when loading. Note: the dragging box was already here in the html, but it was commented out because it was incomplete. The author who added it was planning to add a 'toggle expand' feature but apparently never did. I reused his 'resize' box and removed the few lines of code related to the 'toggle expand' feature.
Published the nwjs version (master branch). Let me know if it works for you. I'll make a pull request later. |
Also, I should have mentioned it earlier, but the content is still clipped: there's a limitation of 1024 characters in the node.
I have no idea how well or bad it will perform. It would be great if yarn had any config option to customize the editor, but it's sadly not the case. |
It works! :) I tried it just now. Couldn't try it earlier (was at work). BTW I'm on Linux with nwjs. I upped the ClipNodeTextLength with no speed issues even on my ageing machine. It even saves and loads from a yarn.txt file. One issue: the resize operation locks the axii to make squares. Can they be unlocked to make rectangles? When I edited the yarn file directly and loaded it with a rectangular shape, they displayed as a rectangle, but once I resized the node it went back to square lock. Also, if possible, the look of the resize button should be a little triangle (like on these github text editor boxes) |
Just changing these lines in node.js:
To this:
Works fine for me! |
Yeah, that's why i forced it to be a square. |
In app.js there is an "updateArrows" function around line 797, and a comment on 838 noting that they are taking advantage of the square nodes to draw the lines:
Accounting for a rectangular shape isn't a trivial change. However, being a game developer and dealing with geometry problems for much of my life it shouldn't be impossible for me. I've probably already done this puzzle at some point. A brief search brings up algorithms like: https://gamedev.stackexchange.com/questions/111100/intersection-of-a-line-and-a-rectangle So, I'll be trying to add this change. Is it part of the original scope? I kinda think so, because specifying height and width were never meant to be always equal. Otherwise just have one value. But if it becomes too much of a headache we can abandon the rectangle and stay with squares. Are there any other issues beyond the arrows that might cause a problem from the rectangle shape? |
I'm actually the one that added this comment in my commit ^^ had to do a few changes in the 'updateArrows' function because the size was hardcoded. I can't think of any issue the rectangular shape would cause. Good luck with it 👍 |
@julsam can you submit this as a pull to the electron branch please :) |
* Allows node resizing by dragging the bottom right corner of a node. It forces it's shape to be a square. I've added this limitation because it would require too much work on the maths of the connection arrows otherwise. * Save to file in json, xml and yarn format. Twine doesn't handle resizing, so the size is not saved in the twee and tw2 format. * Loading a file also handle the size if it finds it in json, xml and yarn format. * Had to change a little the math of the arrows because the size was hardcoded. I've tried opening saved files containing the new 'size' option, and old versions of Yarn (the one linked in the build section of the readme) handled it correctly, ignoring the 'size' option and parsing the rest of the file correctly. And old saved files without the new 'size' option are also read correctly, the 'size' option is optional when loading. Note: the dragging box was already here in the html, but it was commented out because it was incomplete. The author who added it was planning to add a 'toggle expand' feature but apparently never did. I reused his 'resize' box and removed the few lines of code related to the 'toggle expand' feature.
For example in Yarn format, adding another attribute:
position: 75,4
size: 70,50
With a resize hotcorner in the bottom-right on the Node GUI.
Would this be possible?
The text was updated successfully, but these errors were encountered: