yuccai Posted February 22, 2017 Share Posted February 22, 2017 Hello, I find that the Observable class is useful to handle events. However the ActionManager class offers more types of events such as long press for instance but we can only use it on meshes. I would like to know the fundamental difference between these two classes. Does one depend on the other ? How can I reproduce the events from ActionManager for the Observable ? Thanks Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 22, 2017 Share Posted February 22, 2017 Hello! the actionManager relies on observable to do its job. Observables are more low-level events where the ActionManager is here to provide a more user friendly vision Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted February 23, 2017 Share Posted February 23, 2017 In fact that's a good question. ActionManager is used to manipulate events on meshes, but if you want to catch those advanced events outside a mesh (on scene for instance), I think you have to implement yourself the same mechanims already set in scene.attachControl (which raises the ActionManager events). We should create new "advanced" Observers (longpress, leftpick, etc) in BJS and automatically notify them same time as ActionManager. I'll have a look at this. BTW, I've just noticed that ActionManager's doc is not up to date (eg, it is not explained that the difference between onPickEvent and onPickDownEvent is that onPickEvent is only triggered if mesh is clicked but not dragged, while onPickDownEvent is always trigged when mesh is clicked), I'll fix this. Temechon and yuccai 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 23, 2017 Share Posted February 23, 2017 I appreciate the help! Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 7, 2017 Share Posted March 7, 2017 @Deltakosh I have some questions relative to the implementation of the new custom Observers. ¤ My concern is about the fracking names of the new events, mostly because click is for a mouse and tap is for touch... and I don't know what to choose to express both. I remember having the same question when working on ActionManager, but that was solved by distinguishing pick and down. But for Observers I can't use pick, since pick tells us that a mesh is picked, but in Observers there is nothing to pick, we are at scene level... POINTERDOWN already exists and is ok. The new event should be a POINTERCLICK / POINTERTAP, whatever the name it must explicitly tell that we are talking about a single click (with no following drag). Do you have a name suggestion? CLICK, POINTERCLICK, POINTERTAP, POINTERSCHTROUMPF, POINTERPICKINGOFNOOBJECTBUTITSASIF, going crazy, I need a hand...knowing that I also will have a double click event...) ¤ For the double-click event, should the simple click also be raised when double-click happens? I had a look at usual usage, and it tends to be that way (double raises a single first), It is, then, up to the user to handle that the way he wants (for instance waiting for double-click delay before doing something with simple click). But I think it would be more interesting for BJS to provide users a nicer event manager, where they can choose if they want, or not, to raise a previous simple click on double-click listening. For this we can implement a kind of "exclusive" double-click. When activated we do not raise single click on double-click event (and the user do not have to manage that himself), but that also means in this mode every single click is trigged with a delay (waiting to be sure this is really a single and not a double). Do you think this could be interesting? If yes, we have two possibilities: 1. we implement an other event mask (EXCLUSIVEDOUBLECLICK?, EXCLUSIVEDOUBLESCHTROUMPF?) 2. we add a flag somewhere (exclusiveDoubleClickMode, false by default, but where to add it?, in Observers, in Scene...) Which one do you prefer? yuccai 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 7, 2017 Share Posted March 7, 2017 First of all, how do you plan to implement POINTERTAP (like this one ;)) ? I need to be sure this will not slowdown rendering Same for POINTERDOUBLETAP (do you like it?). I do not want to over engineer the event part. I don't think there is a big ask for a way to configure single/double listening. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 7, 2017 Share Posted March 7, 2017 POINTERTAP will be implemented the same way as ActionManager OnPickTrigger. POINTERDOUBLETAP will be implemented by checking time between previous click and current click, if lower than particular delay, it is a double click. At first click, a click is raised, at second click, the time is checked, and a click or a double-click is then raised. If exclusive double click mode is set (not set by default), every click will wait for this specific delay before raising (to determine if single or double). Quote Link to comment Share on other sites More sharing options...
lihis Posted March 7, 2017 Share Posted March 7, 2017 @Vousk-prod. What if i want to trigger the double click immediately when touched the second time? Like OnPickDownTrigger. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 8, 2017 Share Posted March 8, 2017 Double click will be raised immediatly when touched the second time. It's the single click which will be delayed, in "exclusive double click" mode only. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 8, 2017 Share Posted March 8, 2017 And in any case, POINTERDOWN observer will always be raised immediatly on any click. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 8, 2017 Share Posted March 8, 2017 The main purpose of POINTERTAP is to provide a way to get a click event only on real click and not on press-and-move-while-pressed. Quote Link to comment Share on other sites More sharing options...
lihis Posted March 8, 2017 Share Posted March 8, 2017 Huh, for whatever reason i thought "standard" double click === 2 x "full clicks" but now that i tried it to open a text file, the double click indeed triggers on click down. I suppose i just usually release the click so fast i haven't noticed you don't actually have to let it go for the double click to active. Interesting. Well, anyway... what i wanted to throw out there is: since this double-click business seems mainly time related (what else is really different between single and double click?), could there perhaps be a place for some kind of action that helps with time instead of just clicking. I'm thinking something that lets you disable / modify / override already existing actions, or add completely new actions / inputs, but only for a period of time. So you could just have your normal click trigger/action, but then you could have some other action to say that for the next 500ms when you click; do something else than the normal click instead. And if this was possible then you could use that for all kinds of different things, like click some thing and then for the next 3 seconds if you press some key on keyboard do something. And then after the time is done, that input / action is removed. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 8, 2017 Share Posted March 8, 2017 That's an interesting idea, but clearly too specific for being added in BJS. It's rather up to the user to create such a mecanism, based on the events layer BJS provides. Quote Link to comment Share on other sites More sharing options...
lihis Posted March 8, 2017 Share Posted March 8, 2017 Too specific? Isn't that the opposite of too specific, it would help users create double clicks and all kinds of different things them self instead of having to rely on 1 premade solution to double click. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 9, 2017 Share Posted March 9, 2017 So let's proceed step by step: can you do a first PR for the TAP? We will then add the DOUBLETAP once the TAP is ok Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted March 14, 2017 Share Posted March 14, 2017 OK, PR is on its way (under yuccai's git account). Sorry for not being "step by step", there are in fact three new events in this PR : POINTERTAP (the equivalent of ActionManager.onPointerPick, but at scene level) POINTERDOUBLETAP (to catch double click, at scene level) onDoublePickTrigger (ActionManager event to catch a double click on a mesh) Of course implementation is open for discussion in the github pull request. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 14, 2017 Share Posted March 14, 2017 ok no worry Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.