-
Notifications
You must be signed in to change notification settings - Fork 185
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
feat: enable or disable ruler #765
Changes from 2 commits
92397a8
37a6574
c3cc44a
8b717ab
80725c4
e9c5602
5627d39
65a83e0
f1d3f56
34adc72
9ee4f1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,17 @@ export class Ruler extends Component { | |
domainValue: number; | ||
originalData: any; | ||
}[]; | ||
isRulerEnabled = Tools.getProperty( | ||
this.model.getOptions(), | ||
"ruler", | ||
"enabled" | ||
); | ||
|
||
render() { | ||
this.drawBackdrop(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I am not sure about it. These lines of code have existed even before I added the ruler option. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I'm just asking whether removing them on your end still makes everything work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As what I can see do far, removing code within line 253 to line 261 won't break any thing on my end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codes within line 253 to line 261 have already been removed. |
||
this.addBackdropEventListeners(); | ||
if (this.isRulerEnabled) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if ruler was enabled and now isn't? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. backdrop event listener will be remove first and then be created is if needed |
||
this.addBackdropEventListeners(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so we remove & add event listeners every time? This doesn't sound healthy, there should be a better way to only remove or add when we need to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since d3 doesn't have an api for checking whether a specific eventListener is already existed or not. Removing and then adding event listeners when needed is what we can do for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again this is the same situation as the other PR, we just need a boolean here to keep track of event listeners There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A flag, |
||
} | ||
|
||
formatTooltipData(tooltipData) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go inside
render
, that way it's value will update with future renders