MoI discussion forum
MoI discussion forum

Full Version: Parametric design in MoI?

Show messages:  1-20  …  721-740  741-760  761-780  781-800  801-820  821-840  841-860  …  901-912

From: Michael Gibson
30 Jan 2018   [#781] In reply to [#780]
Hi James, well the MoI viewport trackpad handling is done through C++ code responding to Qt events, it's not handled by any script processing. The node editor is running through script and webkit events and yeah there have been quite a few changes in the newer webkit version that MoI v4 is now using.

I do have a macbook here with a trackpad so I can test it over here. I know you've reported it previously but can you please describe the problem again? And do you mean that it used to work ok in MoI v3?

- Michael
From: James (JFH)
30 Jan 2018   [#782] In reply to [#781]
Hi Michael,

RE: trackpad interfacing with NE

>> And do you mean that it used to work ok in MoI v3? <<

The issue only occurs with v4.
All NE updates up to 0.99 work as expected in Moi v3.1

I have not tried "Nodeeditor 1.0 rc1" with v3 but experiences the issue with v4
as has all earlier versions of NE.

.>> please describe the problem again <<

The problem is principally with two finger interactions:
At times panning becomes locked on, so that having changed to single finger movement
it continue to behave as if using two fingers.

At other times attempted panning fails to do anything;
or alternatively will unintentionally select a node and move it.

Similarly with zooming, at time it fails and instead a marque is drawn on screen,
or nothing will happen except for detail info next to each node appearing & disappearing.

As I said before, these issues do not occur with Moi v3.1, only v4 beta and with every iteration of NE
unto and including most recent.

Please let me know if you cannot repeat my problems on your MacBook.

Regards
James
From: Michael Gibson
31 Jan 2018   [#783] In reply to [#782]
Hi James yes I can see there is some difference in behavior between MoI v3 and v4 , maybe v4 is sending events in some unexpected order. I'll see if I can find out what.

But part of the problem is it's based only on mouse oriented behavior - 2 fingers just lightly touching doesn't do panning at all right, it's only 2 fingers _clicked_ down and dragged that does panning. That it keeps panning until you remove both fingers from the click doesn't seem like a bug.

2 fingers lightly touching doesn't do any panning over here, only a mousewheel type zoom if you move up and down.

For a trackpad it's probably better for panning to work by 2 finger movement and zooming with pinching.

I see that in main.js there are some event handlers set up for touch events, but in the handler it's just translating these into mouse events and not handling them as drag/pinch gestures. It could be possible that MoI v3 being based on a older Webkit version did not fire these touch events and MoI v4 does and that's why there is different behavior.

Please give this a try - in the file main.js line 2738 where it sets up the multitouch event handlers, which looks like this:

code:
	//touch events
	this._touchpad_callback = this.bindFunction(this.touchHandler, this);
	//if( 'touchstart' in document.documentElement ) {
	canvas.addEventListener("touchstart", this._touchpad_callback, true);
	canvas.addEventListener("touchmove", this._touchpad_callback, true);
	canvas.addEventListener("touchend", this._touchpad_callback, true);
	canvas.addEventListener("touchcancel", this._touchpad_callback, true);
	//}


Comment out that whole block by adding /* */ around it so it looks like this:

code:
        /*
	//touch events
	this._touchpad_callback = this.bindFunction(this.touchHandler, this);
	//if( 'touchstart' in document.documentElement ) {
	canvas.addEventListener("touchstart", this._touchpad_callback, true);
	canvas.addEventListener("touchmove", this._touchpad_callback, true);
	canvas.addEventListener("touchend", this._touchpad_callback, true);
	canvas.addEventListener("touchcancel", this._touchpad_callback, true);
	//}
        */


Then give that a try and see if you now have the same behavior in MoI v4 as v3 had.

Qt will automatically synthesize mouse events for touches if not already done, so it shouldn't be necessary to have an additional touch handler in HTML that just generates mouse events, that's probably making most of the odd behavior.

If that part is straightened out then maybe it's possible to add different handling for touch gestures to make it behave more trackpad like, like 2 fingers panning and pinching for zooming.

- Michael
From: James (JFH)
31 Jan 2018   [#784] In reply to [#783]
Hi Michael,

Thank you so much...It works perfectly now.

>> For a trackpad it's probably better for panning to work by 2 finger movement and zooming with pinching. <<

Yes zooming by pinching would be a welcome addition, but for now I'm just happy that NE with v4 works just as with v3

Thanks again, much appreciated!
James
From: Michael Gibson
31 Jan 2018   [#785] In reply to [#784]
Hi James, I'm glad that worked. I also looked through the old Webkit version v3 used and did confirm that it did not support touch events so that's definitely why there was a behavior difference between v3 and v4.

After looking through the node editor a bit more I also saw that there are some removeEventListener() for the touch events that should probably be taken out as well if the addEventListener() calls are removed.

I'll also see if I can add a way for a dialog to opt-in to receive some trackpad specific events so it can differentiate between a trackpad scroll (used for panning) versus a mouse wheel scroll (used for zooming) without having to do low level touch event handling.

- Michael
From: Max Smirnov (SMIRNOV)
31 Jan 2018   [#786]
Hi Michael,

thank you very much for your help. I'll add a version check in the next NE release.
code:
if (moi.majorVersionNumber<4) {
	this._touchpad_callback = this.bindFunction(this.touchHandler, this);
	canvas.addEventListener("touchstart", this._touchpad_callback, true);
	canvas.addEventListener("touchmove", this._touchpad_callback, true);
	canvas.addEventListener("touchend", this._touchpad_callback, true);
	canvas.addEventListener("touchcancel", this._touchpad_callback, true);
}

From: Michael Gibson
31 Jan 2018   [#787] In reply to [#786]
Hi Max,

> thank you very much for your help. I'll add a version check in the next NE release.

You're welcome - that version check should work fine although I think the older Webkit in MoI v3 doesn't support those touch events anyway.

- Michael
From: Michael Gibson
3 Feb 2018   [#788] In reply to [#784]
Hi James & Max - for the next beta I've added a ontrackpadgesture HTML event so the node editor can use it to do zoom/pan navigation with a Mac trackpad.

I've got pinch to zoom working, and it could also be possible to use the 2 fingers scroll gesture to do panning instead of mousewheel like zoom (where only up/down motions with the 2 fingers are used), but one complication with doing panning like that is it looks like some nodes respond to onmousewheel themselves to do their own actions. One way to work with that is that if the mouse is over a node like that, then it could send a mousewheel to that node instead of panning. But that would mean that while you were panning around your panning would suddenly stop if you happened to position one of those wheel-responsive nodes under the mouse. Maybe another possibility is to do the mousewheel type scroll if you hold down the Ctrl key. Any thoughts?

- Michael
From: James (JFH)
3 Feb 2018   [#789] In reply to [#788]
Hi Michael & Max,

>> Maybe another possibility is to do the mousewheel type scroll if you hold down the Ctrl key. <<

This would be a good ideal regardless. The addition of node interaction using the identical gesture to zooming is problematic. Or rather can be...if a node circuitry is such that it takes several seconds to draw result to screen, then accidentally dialling of a variable when intending to zoom, can frustratingly breakup work flow.

So yes, to distinguish the 2 types of interaction, the additional requirement of holding down Ctrl key would be ideal.

.>> I've got pinch to zoom working <<

Pinching would indeed be a more natural way for trackpad users to zoom in NE.

As well a "zoom extents" would be the icing on the cake.

Thanks to both of you for your continued development
James
From: Michael Gibson
3 Feb 2018   [#790] In reply to [#789]
Hi James,

re:
> So yes, to distinguish the 2 types of interaction, the additional requirement of holding down
> Ctrl key would be ideal.

Sounds good.


> As well a "zoom extents" would be the icing on the cake.

Is there any existing functionality in the node editor for that? I've got the gesture event set up for that with a 2 finger double tap ("Smart Zoom") but I haven't looked around yet to see if there's an already made node editor function that I can call.

- Michael
From: Michael Gibson
4 Feb 2018   [#791] In reply to [#789]
Hi James & Max - here's how to enable Mac trackpad multi-touch navigation in the node editor when the next MoI beta is out. These are all in the file main.js

Inside LGraphCanvas.prototype.bindEvents add this:
code:
	this._trackpadgesture_callback = this.bindFunction(this.trackpadHandler, this);
	canvas.addEventListener("trackpadgesture", this._trackpadgesture_callback, true);


Inside LGraphCanvas.prototype.unbindEvents add this:
code:
	this.canvas.removeEventListener("trackpadggesture", this.trackpadHandler );


Then add this function:
code:
LGraphCanvas.prototype.trackpadHandler = function(e)
{
	if(!this.graph || !this.allow_dragcanvas || this.selection_mode) return;

	if ( e.gestureType == 'Zoom' )
	{
		// Pinch gesture.

		var speed = 2.0;

		var factor = 1.0 + (e.scaleFactor * speed);
		var newscale = this.scale * factor;

		if ( newscale > 0.0 )
		{
			this.adjustMouseEvent(e);

			this.setZoom( newscale, [ e.localX, e.localY ] );
			this.graph.sendActionToCanvas("setDirty",[true,true]);
		}	
	}
	else if ( e.gestureType == 'Scroll' )
	{
		// 2 fingers scroll gesture.

		// If Ctrl is down, return without calling event.preventDefault() so
		// a mouse wheel event will be triggered.
		if ( e.ctrlKey )
			return;

		var speed = 1.0;
		
		this.offset[0] += (e.deltaX * speed) / this.scale;
		this.offset[1] += (e.deltaY * speed) / this.scale;
		this.graph.sendActionToCanvas("setDirty",[true,true]);

		// Note: don't set this.canvas_moved = true; like right mouse drag uses because
		// it's used to disable context menus if the right mouse was dragged instead
		// of clicked. If we set it here it makes context menus hard to launch.
	}
	else if ( e.gestureType == 'SmartZoom' )
	{
		// 2 finger double tap, use for zoom extents / reset view.

		// TODO

	}
	
	e.preventDefault();
}



- Michael
From: Max Smirnov (SMIRNOV)
7 Feb 2018   [#792] In reply to [#791]
Hi Michael,

thank you! I'll add this code to the next version of Nodeeditor.

P.S. Today I bought a trackpad, so I will add full support of multitouch navigation.
From: Max Smirnov (SMIRNOV)
8 Feb 2018   [#793]
Nodeeditor 1.0 release candidate 2

Added: Multiple start parameters support (example: moi://appdata/nodeeditor/index.html?scheme=Light&somethingelse=123)
Added: You can open second Nodeeditor window by pressing Alt + New button
Added: Nodeeditor doesn't flush clipboard data on window close
Added: Initial Trackpad support (New zoom engine should work fine with all v3/v4 MoI versions. Also I made changes in Knob and Slider nodes. Let's hope I didn't break anything ;))
Added: Some visual improvements

http://moi.maxsm.net/nodeeditor/
From: Frenchy Pilou (PILOU)
8 Feb 2018   [#794] In reply to [#793]
http://moiscript.weebly.com/elephant-systegraveme-nodal.html

French version with the French lang.js with quasi all "deviant" ELephant ! :)

Can you detail the open second Nodeeditor window by pressing "Alt + New button" ?

Say I have N shortcut for the first window Editor : what is "Alt + New Buton" ? ( a new shortcut ? ...

My first ShortCut for N is
moi.ui.createDialog( 'nodeeditor/index.html', 'resizeable,defaultWidth:680,defaultHeight:420', moi.ui.mainWindow )

what is the second ?

say i have B for second same ShortCut
moi.ui.createDialog( 'nodeeditor/index.html', 'resizeable,defaultWidth:680,defaultHeight:420', moi.ui.mainWindow )

Say first window open by N

Press B or Alt + B gives nothing! :)
From: mkdm
8 Feb 2018   [#795] In reply to [#793]
WOW!!!

Thank you very much Max!!

I'll try it soon.

Ciao!
From: James (JFH)
9 Feb 2018   [#796] In reply to [#793]
Great stuff Max,

Zoom functions much better now with trackpad.

Thanks for your continued development
James

P.S. Double tap to zoom to extents is the last piece in the puzzle
From: Max Smirnov (SMIRNOV)
9 Feb 2018   [#797] In reply to [#796]
Hi James,

As Michael wrote above, he will add a trackpad gestures support to the next MoI beta.
Then I'll add pinch/zoom, two-finger scroll, double tap gestures to Nodeeditor.
From: Barry-H
10 Feb 2018   [#798]
Hi Max,
I'm getting this type of display on my Surface Pro 4 of latest nodeeditor.
I don't think this is correct and maybe a resolution issue ?
Barry



Image Attachments:
NodeEditor v1.02.png 


From: Max Smirnov (SMIRNOV)
10 Feb 2018   [#799] In reply to [#798]
Hi Barry

Yes, it's HiDPI mode issue.
Yesterday I also noticed this bug when I run MoI v4+Win7 on my Mac using a virtualization software. So I can reproduce it.
In the same time it works good on Win10.
From: Frenchy Pilou (PILOU)
10 Feb 2018   [#800]
About the second button for the nodeeditor ?
http://moi3d.com/forum/index.php?webtag=MOI&msg=7713.794

Show messages:  1-20  …  721-740  741-760  761-780  781-800  801-820  821-840  841-860  …  901-912