Cosmetic changes to Nodeedit for Moment of inspiration 1.0 rc4a

Next
 From:  rjp74 (RJPOPE)
11552.1 
Cosmetic changes to Nodeedit for Moment of inspiration 1.0 rc4a, Max Smirnov Copyright (C) 2019

Whilst the NodeEditor is wonderful and I use it a lot there are some small niggles which I thought I might be able reduce or eliminate. The fact that I don't know Javascript or any other OO language and my knowledge of coding was on Basic like languages from 50 years ago didn't seem like a good reason to not try.

Menu Related:
1. The menu is too big to fit onto my laptop screen so it is difficult to access the lower members. I had to maximise the screen and click at the top of the screen to be able to access the lowest menu items. Solution: reduce the menu size borders and the text size in index.html.

2. If one moves the mouse away from the menu even by 1 pixel the menu disappears. It is not easy to back up to a higher level and drill down again to find an item. This coupled with 1. is quite irritating. Solution: remove the menu close in the mouseout event listener. in Main.js.

3. In solving 2. I created another issue with Paste not working well as the menu item still existed. Solution: close the menu before doing the paste in Main.js.

4. The order of the sub-items in the menu was in an "as coded" order. Which means extra hunting to find an item. Solution: sort the sub-items in main.js and also in ext.nodelist.js. The top level is left as is. Changing its order created a whole raft of problems.

5. The macro item in the menu always crashed. But the macro item in the left side menu worked. Solution: take the code from the left side menu (ext.nodelist.js) and use it in the RMB menu in main.js. Now Macros work well.

Other:
6. If I was dragging one or more nodes to a new position and my mouse went over the edge of the window the nodes would be relocated to the extreme top left, well off the screen, and a lot of scrolling would be needed to get them back again. Solution: The code did check if the graph exists but what was really necessary was to check if the mouse was inside the graph boundaries or not. If it was outside it picked up coordinates from some other window. in main.js.

7. I reduced the text size in the properties panel. Whilst not necessary it makes having 3 or more panels open the same time easier to use. (index.html).

8. I added a few extra colors into the node color list. in main.js.

9. I added an extra input to the Union node. It only had one and I was always adding a second input to get any union done. No other nodes were altered.

Wishlist:
10. The text input panel in the TextPts node loses its focus far too easily which can make editing difficult. I would prefer to click outside the editing area when the editing was complete. I didn't find a way to do that yet.

To assist in doing this I added in some trace functions. This was most helpful for point 6. The prototypes are left in should anyone else want to use them for something. Search code for trace... I created two as I didn't know how to create just one that worked everywhere. Please note the target directory is hard coded and will need to be changed. I haven't worked out how to code it automatically yet....

None of the underlying data structures have been altered. All my old .nod files load correctly.

I hope that anyone who uses the nodeEditor will find these small cosmetic changes helpful.

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11552.2 In reply to 11552.1 
Thanks for sharing your changes, RJ!

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Frenchy Pilou (PILOU)
11552.3 
---
Pilou
Is beautiful that please without concept!
My Moi French Site My Gallery My MagicaVoxel Gallery
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  MO (MO_TE)
11552.4 In reply to 11552.1 
Hi RJ
I liked your modifications. Specially #2 and #6 were useful for me. Thanks.

>> Wishlist:
>> 10. The text input panel in the TextPts node loses its focus far too easily which can make editing difficult. I would prefer to click outside the editing area when the editing was complete. I didn't find a way to do that yet.

Find this piece of code in the "main.js" file ( line 3546 )
code:
if (title[0] === "_") { content.onmouseout = function() { this.blur(); this.onchange() }}

Replace it with this:
code:
if (title[0] === "_") {
	content.onmouseout = function() { /* this.blur(); */ this.onchange() }; /* Keep the focus */
	content.onkeydown = function(e) {  if ( e.keyCode === 13 && e.ctrlKey ) this.onchange() }; /* CTRL+ENTER to apply changes */
}

In the second line I've just commented out "this.blur();". So textarea doesn't lose the focus on mouse out.
In the third line I've added "CTRL+ENTER" shortcut to apply changes. So no need to click outside of the text area.

EDITED: 8 Oct 2024 by MO_TE

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  rjp74 (RJPOPE)
11552.5 In reply to 11552.4 
Thank you MO,

I tried your revised code and it works splendidly.
I attach a new zip file with this change included.

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Psygorn (DRILLBIT)
11552.6 In reply to 11552.5 
@rjp74 And anyone who can answer my question,

I am using a customized version of Nodeeditor with several third-party .js files added to the directory that I took from other MOI folks.
If I download and install a newer version, could it interfere with my current setup?
I have backups in place, but I prefer to be cautious. Any advice on potential impact to my customized environment would be appreciated.

-Psygorn
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Michael Gibson
11552.7 In reply to 11552.6 
Hi Psygorn,

re:
> If I download and install a newer version, could it interfere with my current setup?

It could if you install it into the same folder overwriting your current files.

If you install it into it's own separate folder inside MOI appdata so that there aren't any files being overwritten then it shouldn't interfere.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All