You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/01/04 15:21:42 UTC
[GitHub] [echarts] plainheart opened a new pull request #16321: fix(dataview): hide tooltip when data view is open.
plainheart opened a new pull request #16321:
URL: https://github.com/apache/echarts/pull/16321
## Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
### What does this PR do?
(1) Fix a bug that the tooltip won't be hidden when the data view is open.
(2) use 5px padding instead of inset 5px to avoid clicking the below layers.
### Fixed issues
- #15542
## Details
### Before: What was the problem?
The tooltip wasn't hidden after the data view was open.
<img src="https://user-images.githubusercontent.com/26999792/148081078-2fc5399b-27d7-4efb-bc32-af13fb945724.gif" width="400">
### After: How is it fixed in this PR?
Hide the tooltip after the data view is open.
<img src="https://user-images.githubusercontent.com/26999792/148080708-f35b330e-de25-45c9-bf51-7b0a35983f46.gif" width="400">
## Misc
<!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
- [ ] The API has been changed (apache/echarts-doc#xxx).
- [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
### Related test cases or examples to use the new APIs
Please refer to `test/toolbox-tooltip.html`
## Others
### Merging options
- [ ] Please squash the commits into a single one when merging.
### Other information
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] echarts-bot[bot] commented on pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#issuecomment-1039905628
Congratulations! Your PR has been merged. Thanks for your contribution! 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang commented on a change in pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang commented on a change in pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#discussion_r778540034
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -318,32 +318,40 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
private _dom: HTMLDivElement;
onclick(ecModel: GlobalModel, api: ExtensionAPI) {
+ // FIXME: better way?
+ setTimeout(() => {
Review comment:
Is it necessary to use `setTimeout`? The `tooltip` should have been displayed before `onclick` event happens. I'm not sure if there is edge cases or something else I didn't thought of.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] plainheart commented on a change in pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#discussion_r778537120
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -352,22 +360,24 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
}
else {
// Use default textarea
- viewMain.appendChild(textarea);
textarea.readOnly = model.get('readOnly');
- textarea.style.cssText = 'width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;';
- textarea.style.color = model.get('textColor');
- textarea.style.borderColor = model.get('textareaBorderColor');
- textarea.style.backgroundColor = model.get('textareaColor');
+ const style = textarea.style;
+ // eslint-disable-next-line max-len
+ style.cssText = 'width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none';
+ style.color = model.get('textColor');
+ style.borderColor = model.get('textareaBorderColor');
+ style.backgroundColor = model.get('textareaColor');
textarea.value = result.value;
+ viewMain.appendChild(textarea);
}
const blockMetaList = result.meta;
const buttonContainer = document.createElement('div');
- buttonContainer.style.cssText = 'position:absolute;bottom:0;left:0;right:0;';
+ buttonContainer.style.cssText = 'position:absolute;bottom:5px;left:0;right:0';
Review comment:
No. I changed to use [`padding:5px`](https://github.com/apache/echarts/blob/8ad3b74c508c2ff8342e6e3e1aad6337404cfdfa/src/component/toolbox/feature/DataView.ts#L335) instead of [`top:5px;right:5px;bottom:5px;left:5px`](https://github.com/apache/echarts/blob/next/src/component/toolbox/feature/DataView.ts#L327). This `bottom:5px` is to keep the previous style.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] plainheart commented on a change in pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#discussion_r778535918
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -318,32 +318,40 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
private _dom: HTMLDivElement;
onclick(ecModel: GlobalModel, api: ExtensionAPI) {
+ // FIXME: better way?
+ setTimeout(() => {
+ api.dispatchAction({
+ type: 'hideTip'
+ });
+ });
+
const container = api.getDom();
const model = this.model;
if (this._dom) {
container.removeChild(this._dom);
}
const root = document.createElement('div');
- root.style.cssText = 'position:absolute;left:5px;top:5px;bottom:5px;right:5px;';
+ // use padding to avoid 5px whitespace
+ root.style.cssText = 'position:absolute;top:0;bottom:0;left:0;right:0;padding:5px';
root.style.backgroundColor = model.get('backgroundColor') || '#fff';
// Create elements
const header = document.createElement('h4');
const lang = model.get('lang') || [];
header.innerHTML = lang[0] || model.get('title');
- header.style.cssText = 'margin: 10px 20px;';
+ header.style.cssText = 'margin:10px 20px';
header.style.color = model.get('textColor');
const viewMain = document.createElement('div');
const textarea = document.createElement('textarea');
- viewMain.style.cssText = 'display:block;width:100%;overflow:auto;';
+ viewMain.style.cssText = 'overflow:hidden';
Review comment:
It seems it will. Should keep the previous style.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] plainheart commented on a change in pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#discussion_r778538504
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -318,32 +318,40 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
private _dom: HTMLDivElement;
onclick(ecModel: GlobalModel, api: ExtensionAPI) {
+ // FIXME: better way?
+ setTimeout(() => {
+ api.dispatchAction({
+ type: 'hideTip'
+ });
+ });
+
const container = api.getDom();
const model = this.model;
if (this._dom) {
container.removeChild(this._dom);
}
const root = document.createElement('div');
- root.style.cssText = 'position:absolute;left:5px;top:5px;bottom:5px;right:5px;';
+ // use padding to avoid 5px whitespace
+ root.style.cssText = 'position:absolute;top:0;bottom:0;left:0;right:0;padding:5px';
root.style.backgroundColor = model.get('backgroundColor') || '#fff';
// Create elements
const header = document.createElement('h4');
const lang = model.get('lang') || [];
header.innerHTML = lang[0] || model.get('title');
- header.style.cssText = 'margin: 10px 20px;';
+ header.style.cssText = 'margin:10px 20px';
header.style.color = model.get('textColor');
const viewMain = document.createElement('div');
const textarea = document.createElement('textarea');
- viewMain.style.cssText = 'display:block;width:100%;overflow:auto;';
+ viewMain.style.cssText = 'overflow:hidden';
Review comment:
Fixed. But I still removed `display:block;width:100%` as a `div` element has such style by default.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang edited a comment on pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang edited a comment on pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#issuecomment-1039907019
Ooops. Forgot to retarget this PR to the master branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] echarts-bot[bot] commented on pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#issuecomment-1004901042
Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
The pull request is marked to be `PR: author is committer` because you are a committer of this project.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang commented on pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang commented on pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#issuecomment-1039907019
Ooops. Forget to retarget this PR to the master branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang commented on a change in pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang commented on a change in pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#discussion_r778532895
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -318,32 +318,40 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
private _dom: HTMLDivElement;
onclick(ecModel: GlobalModel, api: ExtensionAPI) {
+ // FIXME: better way?
+ setTimeout(() => {
+ api.dispatchAction({
+ type: 'hideTip'
+ });
+ });
+
const container = api.getDom();
const model = this.model;
if (this._dom) {
container.removeChild(this._dom);
}
const root = document.createElement('div');
- root.style.cssText = 'position:absolute;left:5px;top:5px;bottom:5px;right:5px;';
+ // use padding to avoid 5px whitespace
+ root.style.cssText = 'position:absolute;top:0;bottom:0;left:0;right:0;padding:5px';
root.style.backgroundColor = model.get('backgroundColor') || '#fff';
// Create elements
const header = document.createElement('h4');
const lang = model.get('lang') || [];
header.innerHTML = lang[0] || model.get('title');
- header.style.cssText = 'margin: 10px 20px;';
+ header.style.cssText = 'margin:10px 20px';
header.style.color = model.get('textColor');
const viewMain = document.createElement('div');
const textarea = document.createElement('textarea');
- viewMain.style.cssText = 'display:block;width:100%;overflow:auto;';
+ viewMain.style.cssText = 'overflow:hidden';
Review comment:
Will this change breaks the behavior when `optionToContent` returns an overflow dom without specifying `height`?
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -352,22 +360,24 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
}
else {
// Use default textarea
- viewMain.appendChild(textarea);
textarea.readOnly = model.get('readOnly');
- textarea.style.cssText = 'width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;';
- textarea.style.color = model.get('textColor');
- textarea.style.borderColor = model.get('textareaBorderColor');
- textarea.style.backgroundColor = model.get('textareaColor');
+ const style = textarea.style;
+ // eslint-disable-next-line max-len
+ style.cssText = 'width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none';
+ style.color = model.get('textColor');
+ style.borderColor = model.get('textareaBorderColor');
+ style.backgroundColor = model.get('textareaColor');
textarea.value = result.value;
+ viewMain.appendChild(textarea);
}
const blockMetaList = result.meta;
const buttonContainer = document.createElement('div');
- buttonContainer.style.cssText = 'position:absolute;bottom:0;left:0;right:0;';
+ buttonContainer.style.cssText = 'position:absolute;bottom:5px;left:0;right:0';
Review comment:
Is `5px` a tiny change on the visual?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] plainheart commented on a change in pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#discussion_r778537120
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -352,22 +360,24 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
}
else {
// Use default textarea
- viewMain.appendChild(textarea);
textarea.readOnly = model.get('readOnly');
- textarea.style.cssText = 'width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;';
- textarea.style.color = model.get('textColor');
- textarea.style.borderColor = model.get('textareaBorderColor');
- textarea.style.backgroundColor = model.get('textareaColor');
+ const style = textarea.style;
+ // eslint-disable-next-line max-len
+ style.cssText = 'width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none';
+ style.color = model.get('textColor');
+ style.borderColor = model.get('textareaBorderColor');
+ style.backgroundColor = model.get('textareaColor');
textarea.value = result.value;
+ viewMain.appendChild(textarea);
}
const blockMetaList = result.meta;
const buttonContainer = document.createElement('div');
- buttonContainer.style.cssText = 'position:absolute;bottom:0;left:0;right:0;';
+ buttonContainer.style.cssText = 'position:absolute;bottom:5px;left:0;right:0';
Review comment:
No. I changed to use [`padding`](https://github.com/apache/echarts/blob/8ad3b74c508c2ff8342e6e3e1aad6337404cfdfa/src/component/toolbox/feature/DataView.ts#L335) instead of [`top:5px;right:5px;bottom:5px;left:5px`](https://github.com/apache/echarts/blob/next/src/component/toolbox/feature/DataView.ts#L327). This `bottom:5px` is to keep the previous style.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang edited a comment on pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang edited a comment on pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#issuecomment-1039907019
Ooops. Forgot to retarget this PR to the master branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang merged pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang merged pull request #16321:
URL: https://github.com/apache/echarts/pull/16321
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] plainheart commented on a change in pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#discussion_r779555096
##########
File path: src/component/toolbox/feature/DataView.ts
##########
@@ -318,32 +318,40 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
private _dom: HTMLDivElement;
onclick(ecModel: GlobalModel, api: ExtensionAPI) {
+ // FIXME: better way?
+ setTimeout(() => {
Review comment:
The tooltip won't disappear if no delay. I don't know why yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang merged pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang merged pull request #16321:
URL: https://github.com/apache/echarts/pull/16321
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] echarts-bot[bot] commented on pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#issuecomment-1039905628
Congratulations! Your PR has been merged. Thanks for your contribution! 👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[GitHub] [echarts] pissang commented on pull request #16321: fix(dataview): hide tooltip when data view is open.
Posted by GitBox <gi...@apache.org>.
pissang commented on pull request #16321:
URL: https://github.com/apache/echarts/pull/16321#issuecomment-1039907019
Ooops. Forget to retarget this PR to the master branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org