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

Formalize type declarations/annotations for shape objects for rendering. #2803

Open
rachel-fenichel opened this issue Aug 12, 2019 · 1 comment
Labels
component: rendering issue: docs Describes missing or incorrect documentation issue: feature request Describes a new feature and why it should be added
Projects

Comments

@rachel-fenichel
Copy link
Collaborator

Objects like Blockly.blockRendering.constants.PUZZLE_TAB are used for rendering now, and should be swappable as long as we have a good description of what properties each one needs to have. Right now that's lacking.

Here is a sample object:

Blockly.blockRendering.constants.NOTCH = (function() {
  var width = Blockly.blockRendering.constants.NOTCH_WIDTH;
  var height = Blockly.blockRendering.constants.NOTCH_HEIGHT;
  var innerWidth = 3;
  var outerWidth = (width - innerWidth) / 2;
  function makeMainPath(dir) {
    return Blockly.utils.svgPaths.line(
        [
          Blockly.utils.svgPaths.point(dir * outerWidth, height),
          Blockly.utils.svgPaths.point(dir * innerWidth, 0),
          Blockly.utils.svgPaths.point(dir * outerWidth, -height)
        ]);
  }
  // TODO: Find a relationship between width and path
  var pathLeft = makeMainPath(1);
  var pathRight = makeMainPath(-1);

  return {
    width: width,
    height: height,
    pathLeft: pathLeft,
    pathRight: pathRight
  };
})();

Notice that it evaluates immediately, so the actual object just has width, height, pathLeft, and pathRight properties for the rest of the rendering code to use.

@rachel-fenichel rachel-fenichel added issue: feature request Describes a new feature and why it should be added issue: triage Issues awaiting triage by a Blockly team member labels Aug 12, 2019
@RoboErikG RoboErikG added affects: develop component: rendering issue: docs Describes missing or incorrect documentation and removed issue: triage Issues awaiting triage by a Blockly team member labels Aug 15, 2019
@RoboErikG RoboErikG added this to the Bug Bash Backlog milestone Aug 15, 2019
@rachel-fenichel rachel-fenichel added this to To do in Rendering Aug 31, 2019
@rachel-fenichel
Copy link
Collaborator Author

Additional note from the rendering hackathon: some shape objects call makeMainPath with -1 or 1, while others use true or false.

We should be consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: rendering issue: docs Describes missing or incorrect documentation issue: feature request Describes a new feature and why it should be added
Projects
No open projects
Rendering
  
To do
Development

No branches or pull requests

2 participants