提交代码
This commit is contained in:
@@ -21,12 +21,10 @@ export class SectionBoxPanel implements IBimComponent {
|
||||
private range: SectionBoxRange;
|
||||
|
||||
private hideBtn!: HTMLButtonElement;
|
||||
private reverseBtn!: HTMLButtonElement;
|
||||
private fitBtn!: HTMLButtonElement;
|
||||
private resetBtn!: HTMLButtonElement;
|
||||
|
||||
private hideLabelEl!: HTMLElement;
|
||||
private reverseLabelEl!: HTMLElement;
|
||||
private fitLabelEl!: HTMLElement;
|
||||
private resetLabelEl!: HTMLElement;
|
||||
private xLabelEl!: HTMLElement;
|
||||
@@ -134,19 +132,13 @@ export class SectionBoxPanel implements IBimComponent {
|
||||
this.options.onHideToggle?.(this.isHidden);
|
||||
}, 'hide');
|
||||
|
||||
this.reverseBtn = this.createButton('reverse', t('sectionBox.actions.reverse'), () => {
|
||||
this.isReversed = !this.isReversed;
|
||||
this.updateButtonStates();
|
||||
this.options.onReverseToggle?.(this.isReversed);
|
||||
}, 'reverse');
|
||||
|
||||
this.fitBtn = this.createButton('fit', t('sectionBox.actions.fitToModel'), () => {
|
||||
this.options.onFitToModel?.();
|
||||
}, 'fit');
|
||||
|
||||
this.resetBtn = this.createButton('reset', t('sectionBox.actions.reset'), () => this.reset(), 'reset');
|
||||
|
||||
[this.hideBtn, this.reverseBtn, this.fitBtn, this.resetBtn].forEach(btn => buttonsContainer.appendChild(btn));
|
||||
[this.hideBtn, this.fitBtn, this.resetBtn].forEach(btn => buttonsContainer.appendChild(btn));
|
||||
|
||||
const slidersContainer = document.createElement('div');
|
||||
slidersContainer.className = 'section-box-sliders';
|
||||
@@ -184,7 +176,6 @@ export class SectionBoxPanel implements IBimComponent {
|
||||
labelEl.textContent = label;
|
||||
|
||||
if (ref === 'hide') this.hideLabelEl = labelEl;
|
||||
else if (ref === 'reverse') this.reverseLabelEl = labelEl;
|
||||
else if (ref === 'fit') this.fitLabelEl = labelEl;
|
||||
else if (ref === 'reset') this.resetLabelEl = labelEl;
|
||||
|
||||
@@ -325,20 +316,17 @@ export class SectionBoxPanel implements IBimComponent {
|
||||
|
||||
private updateButtonStates(): void {
|
||||
if (this.hideBtn) this.hideBtn.classList.toggle('active', this.isHidden);
|
||||
if (this.reverseBtn) this.reverseBtn.classList.toggle('active', this.isReversed);
|
||||
}
|
||||
|
||||
public setLocales(): void {
|
||||
if (!this.hideLabelEl) return;
|
||||
this.hideLabelEl.textContent = t('sectionBox.actions.hide');
|
||||
this.reverseLabelEl.textContent = t('sectionBox.actions.reverse');
|
||||
this.fitLabelEl.textContent = t('sectionBox.actions.fitToModel');
|
||||
this.resetLabelEl.textContent = t('sectionBox.actions.reset');
|
||||
this.xLabelEl.textContent = t('sectionBox.axes.x');
|
||||
this.yLabelEl.textContent = t('sectionBox.axes.y');
|
||||
this.zLabelEl.textContent = t('sectionBox.axes.z');
|
||||
this.hideBtn.title = t('sectionBox.actions.hide');
|
||||
this.reverseBtn.title = t('sectionBox.actions.reverse');
|
||||
this.fitBtn.title = t('sectionBox.actions.fitToModel');
|
||||
this.resetBtn.title = t('sectionBox.actions.reset');
|
||||
}
|
||||
@@ -365,4 +353,4 @@ export class SectionBoxPanel implements IBimComponent {
|
||||
this.element.parentElement.removeChild(this.element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user