-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Port work from 'dev' to master #32
Conversation
Could you please not tag me if it's not actually addressed to me because otherwise I will turn off all notifications. |
Noted! |
0ba7e59
to
198273c
Compare
src/primitives/types/data/latch.js
Outdated
return x && JSON.parse(JSON.stringify(x)); | ||
} | ||
|
||
function deepEq(a, b) { |
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.
Let's replace these with the equivalent lodash.
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.
BTW: re import { isEqual } from 'lodash'
vs import isEqual from lodash.isequal
... I used to use the method-specific packages but stopped because https://lodash.com/per-method-packages
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.
Ah, nice - so instead I will import with a deeper relative import and we’ll be set.
@@ -112,7 +112,7 @@ export class Sprite extends Base { | |||
this.geometry.dispose(); | |||
this.edgeMaterial.dispose(); | |||
this.fillMaterial.dispose(); | |||
this.nreders = | |||
this.renders = |
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.
typo fixed!
@ChristopherChudzicki this is ready for a look, if you wouldn't mind! |
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 all looks good to me 👍 I have not tried to understand the reverse/latch primitives much, but the examples seem to work.
I left a few minor js comments about arguments
.
One thing that I think should be added—and parts or all of this could be done separately—is typescript definitions. Things I think should happen:
-
add a test using expect-type that would fail if a PR, such as this, added more primitives without adding the types. This wasn't high on my priority list since I didn't think we'd be adding more primitives...and maybe we won't after this. But it would be easy to do, so might as well do it.
expect-type
is a package I've used before that is nice for compile-time assertions about typescript. I first came across its use in https://github.com/sequelize/sequelize when I added a type there, and I've been very happy with it. -
Add types + ts-documentation for the new
latch
andreveal
primitives. This would involve:- in
node_types.ts
, new interfacesSetTraitsReverse
,GetTraitsReverse
corresponding to the newreverse
trait added in traits.ts
This defines a type for the "reverse" trait which is ued as part of the new Reverse primitive. The reason there would be two interfaces (the Get and Set variants) is that mathbox allows multiple ways of setting a prop, then standardizes to single array. (E.g., "classes" can be set as a space-separated string or an array, but it is always standardized to an array.)
-
in
node_types.ts
, newReversePropsNormalized
andReverseProps
. The props for the primitive are determined by the traits used in the primitive, so it's just a matter of something likeexport interface ReversePropsNormalized extends GetTraitsNode, GetTraitsOperator, GetTraitsReverse {}
And something similar, with the Set traits, for
ReverseProps
. -
in
node_types.ts
, add the new indices and channels props toGetTraitsShader
andSetTraitsShader
-
Add reveal and latch methods to
MathboxSelection
, etc, intypes.ts
. -
Add tsdoc comments in
node_types.ts
andtypes.ts
for the new traits + props, as well as for the
Re this last point... I would eventually like to stop using
src/docs
for doc-generation, and instead generate docs just for the tsdoc comments. The tsdoc comments are much more verbose (in terms of lines of code, I mean). But they are more standard.I've been experimenting with typedoc as an alternative to
src/docs
. You can see its current output withnpm run typedoc
. It's pretty good, if a bit click-heavy on the navigation. - in
I am happy to do any or all those items. Let me know your preference.
} | ||
|
||
make() { | ||
super.make(...arguments); |
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.
super.make(...arguments); | |
super.make(); |
This superclass's make
method has no args. I am confident this never does anything.
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.
Sounds good, this was a suggestion from a decaffeinate script I ran to check my conversion!
} | ||
|
||
unmake() { | ||
return super.unmake(...arguments); |
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.
Same: The superclass's unmake has no args anyway (and does not reference the special arguments
object)
this._resolveOffset("items", dims) | ||
); | ||
|
||
return super.resize(...arguments); |
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.
Same.
size: 10, | ||
points: "<<", | ||
colors: "<", | ||
}); |
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.
}); | |
color: 0xFFFFFF | |
}); |
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.
For the nice bright colors...
Maybe this should happen by default if colors
is provided and color
is not...
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 agree!
This is a followup to #32, adding typescript definitions for those changes
This is a followup to #32, adding typescript definitions for those changes
This is a followup to #32, adding typescript definitions for those changes
This PR moves over all of @unconed 's work from the
dev
branch that I lost during my initial conversion to JS. Notes from that CHANGELOG:0.0.6-dev
fps
on a data buffer, catch up correctly if starting late (e.g. on a slide)indices
andchannels
props to<shader />
to match<resample />
.width
.expr
in script steps (steps, play, ...) tobind
to avoid collision withexpr
prop.<layer />
to flatten to an orthogonal viewnormals
to<surface />
<latch />
to control expr/data updates when conditions change