-
Notifications
You must be signed in to change notification settings - Fork 3k
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
SVG borders: Respond to dynamic changes in selection border col… #6593
SVG borders: Respond to dynamic changes in selection border col… #6593
Conversation
This commit allows the selection borders, selection corner (desktop) and selection handles (mobile) to respond to the dynamic changes of width and color setting. For example, use the below code in Handsontable to set border of the currently selected cell to be "1px green": ``` hot.selection.highlight.cell.settings.border.width = 1; hot.selection.highlight.cell.settings.border.color = 'green'; hot.render(); ``` Default selection settings: ``` hot.selection.highlight.cell.settings.border.width = 2; hot.selection.highlight.cell.settings.border.color = '#4b89ff'; hot.selection.highlight.fill.settings.border.width = 1; hot.selection.highlight.fill.settings.border.color = '#ff0000'; hot.selection.highlight.areas.forEach((selection) => { selection.settings.border.width = 1; selection.settings.border.color = '#4b89ff'; }); hot.render(); ```
I didn't find regression and other bugs, but I had a problem reproducing a new feature. With the help of @warpech I was able to write it in the function and only in this way it worked in my environment. I need to debug those to make a demo. Right now I can show on gif working of
You can change style of selection.areas only for number if instances that were created. On the gif, changed style have only two instances, the thirt one has default style. |
previously the inset value of the border was fixed to 1, making it look right only when the border width was 2. Now the inset is calculated correctly from any border width.
New issue explaining a problem discovered in this PR: #6627 (colors order on fixed borders) |
New issue explaining a problem discovered in this PR: #6628 (selection, fill and autoFill covers fixedBorder or frozen-border) |
877d933
to
3e13b24
Compare
…the border of a selection is rendered previously, the className "current" had a magical hard-coded consequence of changing the border to be rendered inside of the cell. From now on, this behavior is defined by setting a property `strokeAlignment: 'inside'` on the border settings. The name `strokeAlignment` is inspired by the new SVG Strokes spec proposal: https://svgwg.org/specs/strokes/#SpecifyingStrokeAlignment
…ight edges according to the intended rendering of cell selections, all 4 borders should be rendered inside of the cell. With the previous implementation that worked well only with border width 2px. After this change, it works like intended with any border width.
… cell this is not a immediately noticeable change, because it renders the same as they have 1px width. However, when a customer uses a different configuration, they are supposed to be rendered inside of the cell and it will become visible.
As discussed on the today's status meeting, I will merge this PR without review to the "master" PR #6157, because having a single source-of-truth PR is easier both for code reviewer and the tester. |
Context
This PR is a response to the comment #6467 (comment). It the selection borders, selection corner (desktop) and selection handles (mobile) to respond to the dynamic changes of width and color setting.
For example, use the below code in Handsontable to set border of the currently selected cell to be "1px green":
Default selection settings:
☢️ However, there is one serious pitfall:
selection.highlight.areas
objects are instantiated only after they are used for the first time. So you can only set them after the end user made an area selection (multiple area selections) for the first time.How has this been tested?
I added an automated test for desktop and mobile.
Types of changes
Related issue(s):
Checklist: