Skip to content

Render shape label while drawing - #6608

Merged
archmoj merged 5 commits into
masterfrom
shape-label-while-drawing
May 19, 2023
Merged

Render shape label while drawing#6608
archmoj merged 5 commits into
masterfrom
shape-label-while-drawing

Conversation

@emilykl

@emilykl emilykl commented May 18, 2023

Copy link
Copy Markdown
Contributor

Closes #6540

Render shape label text during initial shape draw.

Codepen demo here: https://codepen.io/emily_plotly/pen/eYLrKNV

This PR leverages the existing newshape code to render the shape label while the shape is being drawn.

@alexcjohnson @archmoj I'm very interested to get your feedback on whether this approach makes sense and whether there might be any unintended side effects.

Note: I moved the drawLabels() function from shapes/draw.js into its own file; that makes up the bulk of the changes in terms of # of lines. No changes to that function itself.

Outstanding changes:

  • Fix broken Jasmine tests
  • Make label partially transparent like the shape itself

@emilykl
emilykl requested review from alexcjohnson and archmoj May 18, 2023 21:46
@@ -0,0 +1,268 @@
'use strict';

@emilykl emilykl May 18, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is just the drawLabels() function which used to be in shapes/draw.js being moved into its own file (in order to call it elsewhere without circular imports). No code changes.

}

var isOpenMode = openMode(dragmode);
var newShape = createShapeObj(outlines, dragOptions);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The only actual change here is moving some of the logic into a separate createShapeObj() function

@archmoj archmoj added bug something broken feature something new status: has TODOs labels May 18, 2023
@archmoj

archmoj commented May 19, 2023

Copy link
Copy Markdown
Contributor

Nicely done.
/ :dancer: /
\ 💃 \

@emilykl

emilykl commented May 19, 2023

Copy link
Copy Markdown
Contributor Author

Tagging @JulianWgs as well!

@archmoj
archmoj merged commit 6607870 into master May 19, 2023
@archmoj
archmoj deleted the shape-label-while-drawing branch May 19, 2023 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render newshape text and texttemplate during initial shape draw

2 participants