fix(stage): 修复辅助线显隐的bug

fix #444
This commit is contained in:
oceanzhu 2022-10-20 20:40:13 +08:00
parent 11e0e04cbd
commit f416530d38

View File

@ -12,6 +12,7 @@ export default class Rule extends EventEmitter {
private container: HTMLDivElement; private container: HTMLDivElement;
private containerResizeObserver: ResizeObserver; private containerResizeObserver: ResizeObserver;
private isShowGuides = true;
constructor(container: HTMLDivElement) { constructor(container: HTMLDivElement) {
super(); super();
@ -32,16 +33,18 @@ export default class Rule extends EventEmitter {
} }
/** /**
* * 线
* @param show * @param isShowGuides
*/ */
public showGuides(show = true) { public showGuides(isShowGuides = true) {
this.isShowGuides = isShowGuides;
this.hGuides.setState({ this.hGuides.setState({
showGuides: show, showGuides: isShowGuides,
}); });
this.vGuides.setState({ this.vGuides.setState({
showGuides: show, showGuides: isShowGuides,
}); });
} }
@ -135,6 +138,7 @@ export default class Rule extends EventEmitter {
lineColor: '#000', lineColor: '#000',
textColor: '#000', textColor: '#000',
style: this.getGuidesStyle(type), style: this.getGuidesStyle(type),
showGuides: this.isShowGuides,
}); });
private hGuidesChangeGuidesHandler = (e: GuidesEvents['changeGuides']) => { private hGuidesChangeGuidesHandler = (e: GuidesEvents['changeGuides']) => {