Open brannondorsey opened 8 years ago
Awesome improvements with https://github.com/brangerbriz/liBB.js/pull/42. Here are some thoughts:
canvasConstructor
optional config object property in the constructor can be named canvas
for clarity. mapX()
, mapY()
, and mapZ
static methods (i.e. BB.LeapMotion.mapY
rather than BB.LeapMotion.prototype.mayY
)? It seems to me that behavior should be tied to each leap motion object itself. This isn't too much of an issue and if you've got a specific intention behind it that I am missing then maybe it makes sense. Although it is a bit of an outlier situation it may be nice at some point to use two LeapMotions in one project (granted I'm not even sure the Leap library supports multiple devices) and I can see the rare possibility of wanting to define an interaction box per leap rather than for all leaps as a whole.mapX()
and mapY()
eventually support minY
, minX
, maxY
, or maxX
properties for their config objects or is that functionality that only mapZ()
will provide? If not we should not pass a config object to those methods if they only have one property available to configure, and should instead pass that value as a single parameter.config.mapDimension
property in the constructor config is the best way to configure the enabling/disabling of the Z dimension. These lines of code make me fearful of a bug where the programmer passes a canvas into canvasConstructor
and sets mapDimension: 3
in the config, or if no canvas is given but mapDimension
is not set or set to 2
. Is there any harm in always using three dimensions (even if a canvas is specified) and having a default map range (something arbitrary but documented like -1000 to 1000)? Then it can be assumed that in a case like that a user would probably only use x
and y
values but would have the option of using z
(even if they didn't call mapZ()
). That also skips a config step of setting the number of dimensions.hey Brannon i have worked on the new suggestion, but i would like to talk to you to clear some things out, maybe we can skype tomorrow, let me know. Thanks !
Hey Fabian, great! I will open skype now and see if there is a good time we can connect today.
On Thu, Mar 31, 2016 at 3:38 PM, Fabian Valencia notifications@github.com wrote:
hey Brannon i have worked on the new suggestion, but i would like to talk to you to clear some things out, maybe we can skype tomorrow, let me know. Thanks !
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/brangerbriz/liBB.js/issues/40#issuecomment-204116523
Hey @cfvalencia9277, I've got a few suggestions for the Leap Motion module:
getLeapData(...)
functionality in theBB.LeapMotion()
constructor instead of as it's own function. There is no real use case to use this module without needed whatgetLeapData(...)
provides, so we might as well put it in the constructor. Besides, in JavaScript it is the convention to have any function that begins withget
return a value instead of simply being avoid
function.getLeapData(...)
so that itswidth
andheight
properties can be accessed. Instead we should pass inwidth
andheight
(anddepth
) properties in the constructor with the option to update/alter them after construction via some method as well.config-object
style of initializing constructors that looks like this:vs
This also allows us to easily have defaults if a property is not included in the config object. That looks like this in code.
canvasX
andcanvasY
were simply renamed tox
andy
. Down the road I'm hoping to integrate this leap module withBB.Pointer
, especially because the idea of a leap motion as a device havingx
,y
andz
properties doesn't really make sense, but rather the leap object could be funneled into aBB.Pointer
instance and then it would extract that data from a finger (kind of like howBB.MouseInput
works withBB.Pointer
to provide it with added functionality.BB.LeapMotion.lastFrame
property that begins asnull
and then in eachcontroller.on("frame")
callback it assigns the current value offrame
tolastFrame
. That way we can have access to properties likehands
, etc...BB.LeapMotion
via an event-style API as well as the current property-access API, so that if the programmer preferred to use this style if they preferred:vs
This is less pressing than the other methods however. Plus, I have been working on but have yet to push a
BB.EventEmitter
class thatBB.LeapMotion
could extend from which would make this easier. I will ping you when that is included in the library core and then these updates can be made so you can hold off on implementing no. 7 for now.I'll be back in the studio on Friday if you have any questions. Thanks for your contributions!