Fix: Show 'Add Carrier' button when panel has no carriers
Previously the button to add a new Hutschiene was only shown below the last existing carrier. Now it also appears when a panel exists but has no carriers yet. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b0dc03bebe
commit
6ff56e89e4
1 changed files with 8 additions and 1 deletions
|
|
@ -7211,7 +7211,7 @@
|
|||
$controls.append($addPanel);
|
||||
}
|
||||
|
||||
// Add Carrier button (below each panel's last carrier)
|
||||
// Add Carrier button (below each panel's last carrier, or at top if no carriers)
|
||||
this.panels.forEach(function(panel) {
|
||||
var panelCarriers = self.carriers.filter(function(c) { return c.panel_id == panel.id; });
|
||||
var lastCarrier = panelCarriers[panelCarriers.length - 1];
|
||||
|
|
@ -7228,6 +7228,13 @@
|
|||
var $copyCarrier = $('<button class="schematic-copy-carrier" data-carrier-id="' + lastCarrier.id + '" data-panel-id="' + panel.id + '" title="Hutschiene kopieren" style="position:absolute;left:' + (addCarrierX + 35) + 'px;top:' + addCarrierY + 'px;' + btnStyle + '"><i class="fas fa-copy" style="font-size:12px;"></i></button>');
|
||||
$controls.append($copyCarrier);
|
||||
}
|
||||
} else {
|
||||
// No carriers in this panel - show add carrier button at top
|
||||
var addCarrierY = self.calculatedTopMargin + 20;
|
||||
var addCarrierX = (panel._x || 0) + 60;
|
||||
|
||||
var $addCarrier = $('<button class="schematic-add-carrier" data-panel-id="' + panel.id + '" title="Hutschiene hinzufügen" style="position:absolute;left:' + addCarrierX + 'px;top:' + addCarrierY + 'px;' + btnStyle + '">+</button>');
|
||||
$controls.append($addCarrier);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue