(blocks: Array<SequenceBlock>, broker: SelectionBroker)
| 1982 | } |
| 1983 | |
| 1984 | public initializeContent(blocks: Array<SequenceBlock>, broker: SelectionBroker): void { |
| 1985 | if (!this.initialized) { |
| 1986 | this.gridAccessor = new GridAccessor(this.sequenceView); |
| 1987 | this.intervalsAccessor = new IntervalElementsAccessor(this.sequenceView); |
| 1988 | this.cssVariables = new CSSVariables(); |
| 1989 | this.userSettings = new UserSettings(); |
| 1990 | this.displayResetter = new DisplayResetter(this); |
| 1991 | // Indicates whether the RangeView is displayed beside or below the SequenceView. |
| 1992 | this.userSettings.addSetting("landscapeMode", false, |
| 1993 | this.displayResetter.resetLandscapeMode.bind(this.displayResetter)); |
| 1994 | // Indicates whether the grid axes are switched. |
| 1995 | this.userSettings.addSetting("flipped", false, |
| 1996 | this.displayResetter.resetFlipped.bind(this.displayResetter)); |
| 1997 | this.blocksData = new BlocksData(this, blocks); |
| 1998 | this.divs = new Divs(this.userSettings, |
| 1999 | this.instructionRangeHandler.getInstructionRangeString()); |
| 2000 | this.displayResetter.updateClassesOnContainer(); |
| 2001 | this.scrollHandler = new ScrollHandler(this); |
| 2002 | this.rowConstructor = new RowConstructor(this); |
| 2003 | this.stringConstructor = new StringConstructor(this); |
| 2004 | this.selectionHandler = new RangeViewSelectionHandler(this); |
| 2005 | this.sequenceView.setRangeViewSelectionHandler(this.selectionHandler); |
| 2006 | this.focusHandler = new FocusHandler(this); |
| 2007 | broker.addBlockHandler(this.focusHandler); |
| 2008 | broker.addRegisterAllocatorHandler(this.focusHandler); |
| 2009 | const constructor = new RangeViewConstructor(this); |
| 2010 | constructor.construct(); |
| 2011 | this.cssVariables.setVariables(this.instructionRangeHandler.numPositions, |
| 2012 | this.divs.registers.children.length); |
| 2013 | this.phaseChangeHandler = new PhaseChangeHandler(this); |
| 2014 | let maxVirtualRegisterNumber = 0; |
| 2015 | for (const register of this.focusHandler.virtualRegisterToRowMap.keys()) { |
| 2016 | maxVirtualRegisterNumber = Math.max(maxVirtualRegisterNumber, register); |
| 2017 | } |
| 2018 | this.maxLengthVirtualRegisterNumber = Math.floor(Math.log10(maxVirtualRegisterNumber)) + 1; |
| 2019 | this.initialized = true; |
| 2020 | } else { |
| 2021 | // If the RangeView has already been initialized then the phase must have |
| 2022 | // been changed. |
| 2023 | this.phaseChangeHandler.phaseChange(); |
| 2024 | } |
| 2025 | } |
| 2026 | |
| 2027 | public show(): void { |
| 2028 | if (!this.isShown) { |
no test coverage detected