Skip to content
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

Remove broken debug bindings #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/primitives/types/draw/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ export class Grid extends Primitive {

make() {
// Build transition mask lookup
let axis;
let mask = this._helpers.object.mask();

// Build fragment material lookup
const material = this._helpers.shade.pipeline() || false;

axis = (first, second, transpose) => {
const axis = (first, second, transpose) => {
// Prepare data buffer of tick positions
let position;
const detail = this._get(first + "axis.detail");
Expand Down Expand Up @@ -133,7 +132,7 @@ export class Grid extends Primitive {
// Register lines
const lines = (() => {
const result = [];
for (axis of this.axes) {
for (const axis of this.axes) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was rebinding the function binding...

result.push(axis.line);
}
return result;
Expand Down Expand Up @@ -171,7 +170,7 @@ export class Grid extends Primitive {
changed["grid.crossed"] ||
(changed["grid.axes"] && this.props.crossed)
) {
return this.rebuild();
this.rebuild();
}

if (
Expand All @@ -183,12 +182,14 @@ export class Grid extends Primitive {
touched["origin"] ||
init
) {
return this.updateRanges();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these artifacts are all over the codebase from the coffeescript conversion.

this.updateRanges();
}
}

updateRanges() {
const axis = (x, y, range1, range2, axis) => {
const { axes, origin } = this.props;

const axisFn = (x, y, range1, range2, axis) => {
const { second, resolution, samples, line, buffer, values } = axis;

// Set line steps along first axis
Expand All @@ -214,22 +215,18 @@ export class Grid extends Primitive {
};

// Fetch grid range in both dimensions
const { axes, origin } = this.props;
const range1 = this._helpers.span.get("x.", axes[0]);
const range2 = this._helpers.span.get("y.", axes[1]);

// Update both line sets
const { lineX, lineY } = this.props;

if (lineX) {
axis(axes[0], axes[1], range1, range2, this.axes[0]);
axisFn(axes[0], axes[1], range1, range2, this.axes[0]);
}
if (lineY) {
axis(axes[1], axes[0], range2, range1, this.axes[+lineX]);
axisFn(axes[1], axes[0], range2, range1, this.axes[+lineX]);
}
window.cake1 = this.axes[0].buffer;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops!

window.cake2 = this.axes[1].buffer;
window.cake3 = this.axes[0];
}
}
Grid.initClass();
10 changes: 6 additions & 4 deletions src/util/axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import { Vector4 } from "three";
export const setOrigin = function (vec, dimensions, origin) {
if (+dimensions === dimensions) {
dimensions = [dimensions];
} else {
dimensions = Array.from(dimensions);
}
const x = Array.from(dimensions).includes(1) ? 0 : origin.x;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while debugging a different problem that turned out to be user error, I introduced this mild cleanup.

const y = Array.from(dimensions).includes(2) ? 0 : origin.y;
const z = Array.from(dimensions).includes(3) ? 0 : origin.z;
const w = Array.from(dimensions).includes(4) ? 0 : origin.w;
const x = dimensions.includes(1) ? 0 : origin.x;
const y = dimensions.includes(2) ? 0 : origin.y;
const z = dimensions.includes(3) ? 0 : origin.z;
const w = dimensions.includes(4) ? 0 : origin.w;
return vec.set(x, y, z, w);
};

Expand Down