* Duplicate an existing panel. Add it immediately after the panel being duplicated. * @param {number} panelIndex - Position of the panel in the array of panels on this post.
(panelIndex)
| 38 | * @param {number} panelIndex - Position of the panel in the array of panels on this post. |
| 39 | */ |
| 40 | duplicatePanel(panelIndex) { |
| 41 | const existingPanel = this.panels[panelIndex]; |
| 42 | const newSubPanels = []; |
| 43 | for (const subPanel of existingPanel.sign.subPanels) { |
| 44 | newSubPanels.push(Object.assign(new SubPanels(), subPanel)); |
| 45 | } |
| 46 | |
| 47 | const newExitTabs = []; |
| 48 | for (const exitTab of existingPanel.exitTabs) { |
| 49 | newExitTab.push(Object.assign(new ExitTab(), exitTab)); |
| 50 | } |
| 51 | |
| 52 | const newSign = new Sign({ |
| 53 | shieldPosition : existingPanel.sign.shieldPosition, |
| 54 | subPanels : newSubPanels, |
| 55 | sheildBacks : existingPanel.sign.sheildBacks, |
| 56 | guideArrow : existingPanel.sign.guideArrow, |
| 57 | guideArrowLanes : existingPanel.sign.guideArrowLanes, |
| 58 | }); |
| 59 | const newPanel = Object.assign(new Panel(), existingPanel); |
| 60 | newPanel.sign = newSign; |
| 61 | newPanel.exitTab = newExitTabs; |
| 62 | this.panels.splice(++panelIndex, 0, newPanel); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Delete an existing panel at the requested index. |
no outgoing calls
no test coverage detected