-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add root(options, binds) function to API #57
base: master
Are you sure you want to change the base?
Conversation
@@ -166,7 +171,7 @@ export class API { | |||
} | |||
_reset() { | |||
let left; | |||
return (left = this._up != null ? this._up.reset() : undefined) != null | |||
return (left = this._up != null ? this._up._reset() : undefined) != null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops!
@@ -70,7 +70,7 @@ describe("live properties", () => { | |||
|
|||
const size1 = p.get("size") | |||
const opacity1 = p.get("opacity") | |||
expect(Math.abs(size1 - 20.5)).toBeLessThan(0.2) | |||
expect(Math.abs(opacity1 - 0.5)).toBeLessThan(0.2) | |||
expect(Math.abs(size1 - 20.5)).toBeLessThan(0.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test was flaky on me, so I'm relaxing the bounds again...
// default focus | ||
expect(mathbox.get("focus")).toBe(1); | ||
|
||
// set via root and see the change reflected in mathbox. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had another test that exposed #59, so here I'm only testing the non-binds.
@ChristopherChudzicki we could also remove |
Hey @sritchie I have looked at this a bit and will try to look more closely today. Thanks for drawing my attention to the Two questions for you:
Regarding (1),
|
@ChristopherChudzicki okay, here we go! First quick note: I loaded up your story with live position and proxy=true and it looks pretty good to my eye. What do you think is wrong there? Now your Qs:
In retrospect, these docs DO cover it all: https://github.com/unconed/mathbox/blob/master/docs/primitives.md#base/root but figuring out how each primitive uses each option is tough. So it felt appropriate to add a method for the one missing primitive. BUT I'm fine abandoning that and adding more docs if this feels like extra clutter. Separate comment coming for 2. |
I am becoming more attracted to the idea of components that exist only to install a bunch of hooks that can reactively update config settings. I've been thinking through your observations here: ChristopherChudzicki/mathbox-react#24 In mathbox.cljs, I have a version of the (The code lives here, take a look at the hooks: https://github.com/mentat-collective/mathbox.cljs/pull/9/files#diff-2005ffcffcad9436899682298be933ef32374e5c6a60e864aa74b120b47b32baR33-R82) It feels like it would be a BETTER pattern instead to make separate
In fact I think this might be the answer to configuring all of the threestrap plugins. Camera with proxy true is sort of this kind of component already, would you agree? If we embrace this design, I think having a @ChristopherChudzicki let me know what you think of this. (Of course we can add a |
@sritchie re
Regarding discoverability, do you think it would help to change all the examples from My approach for discoverability has been to add the TS types, though I do not know how much clojure benefits from those, if at all. The two things that give me reason I hesitate to add this is that the Mathbox-reactOn the other hand, I do see clear benefit in adding a I like the idea about a and components for mathbox-react. (I don't really think we should add such things to mathbox core.) Going to try and experiment a bit with this today and write more later. |
This PR adds the
root()
function that I had been missing! The advantage here in a mathbox-react context is that you can set root properties now without messing with aref
. This simplifies my initialization code...@ChristopherChudzicki , after this is in I think we can add a
Root
component to mathbox-react, yeah? Then all of the initial camera settings from the examples can be replaced with uses of theCamera
component (with proxy set to true) andRoot
takes care of theset()
calls.Here's what the new example I added looks like: