@@ -72,6 +72,7 @@ import { DropPosition } from "./types.js";
7272import TileMapUtil from "./util/tileMapUtil.js" ;
7373import PaintUtil from "./util/paintUtil.js" ;
7474import PaletteUtil from "./util/paletteUtil.js" ;
75+ import TileMapList from "./models/tileMapList.js" ;
7576
7677
7778/* ****************************************************************************************************
@@ -1744,6 +1745,8 @@ function handleImportPaletteModalDialogueOnConfirm(args) {
17441745 getUIState ( ) . importPaletteAssemblyCode = args . paletteData ;
17451746 state . saveToLocalStorage ( ) ;
17461747
1748+ currentProject . nativePalettes = null ;
1749+
17471750 paletteEditor . setState ( {
17481751 paletteList : getRenderPaletteList ( ) ,
17491752 selectedPaletteIndex : getProjectUIState ( ) . paletteIndex
@@ -1828,6 +1831,8 @@ function paletteSetColourAtIndexWithoutSaving(paletteIndex, colourIndex, colour)
18281831 const newColour = PaletteColourFactory . create ( colour . r , colour . g , colour . b ) ;
18291832 palette . setColour ( colourIndex , newColour ) ;
18301833
1834+ currentProject . nativePalettes = null ;
1835+
18311836 paletteEditor . setState ( {
18321837 paletteList : getRenderPaletteList ( ) ,
18331838 displayNative : getUIState ( ) . displayNativeColour
@@ -1916,6 +1921,8 @@ function handleImageImportModalOnConfirm(args) {
19161921
19171922 state . saveToLocalStorage ( ) ;
19181923
1924+ currentProject . nativePalettes = null ;
1925+
19191926 paletteEditor . setState ( {
19201927 paletteList : getRenderPaletteList ( ) ,
19211928 selectedPaletteIndex : getRenderPaletteList ( ) . length - 1
@@ -2615,13 +2622,6 @@ function formatForNoProject() {
26152622
26162623 currentProject . nativePalettes = null ;
26172624
2618- const dummyProject = createEmptyProject ( { systemType : 'smsgg' } ) ;
2619- while ( dummyProject . paletteList . length > 1 ) {
2620- dummyProject . paletteList . removeAt ( 0 ) ;
2621- }
2622- dummyProject . tileMapList . clear ( ) ;
2623- dummyProject . tileSet . clear ( ) ;
2624-
26252625 projectToolbar . setState ( {
26262626 enabled : false ,
26272627 projectTitle : ' ' ,
@@ -2680,8 +2680,8 @@ function formatForNoProject() {
26802680 enabled : false
26812681 } ) ;
26822682 tileManager . setState ( {
2683- tileMapList : dummyProject . tileMapList ,
2684- tileSet : dummyProject . tileSet ,
2683+ tileMapList : new TileMapList ( [ ] ) ,
2684+ tileSet : new TileSet ( ) ,
26852685 palette : null ,
26862686 paletteList : null ,
26872687 selectedTileMapId : null
@@ -3857,6 +3857,8 @@ function paletteReorder(paletteId, targetPaletteId, position) {
38573857
38583858 state . saveToLocalStorage ( ) ;
38593859
3860+ currentProject . nativePalettes = null ;
3861+
38603862 updatePaletteLists ( { skipTileEditor : true } ) ;
38613863}
38623864
@@ -3871,6 +3873,8 @@ function paletteNew() {
38713873
38723874 state . saveToLocalStorage ( ) ;
38733875
3876+ currentProject . nativePalettes = null ;
3877+
38743878 updatePaletteLists ( { skipTileEditor : true } ) ;
38753879
38763880 paletteSelectById ( newPalette . paletteId ) ;
@@ -3894,6 +3898,8 @@ function paletteClone(paletteIndex) {
38943898
38953899 state . saveToLocalStorage ( ) ;
38963900
3901+ currentProject . nativePalettes = null ;
3902+
38973903 updatePaletteLists ( { skipTileEditor : true } ) ;
38983904
38993905 paletteSelectById ( newPalette . paletteId ) ;
@@ -3925,6 +3931,8 @@ function paletteDelete(paletteIndex) {
39253931
39263932 state . saveToLocalStorage ( ) ;
39273933
3934+ currentProject . nativePalettes = null ;
3935+
39283936 updatePaletteLists ( ) ;
39293937
39303938 const palette = getPaletteList ( ) . getPalette ( paletteIndex ) ;
@@ -3983,6 +3991,8 @@ function paletteListSort(field) {
39833991 getPaletteList ( ) . setPalettes ( palettes ) ;
39843992 state . saveProjectToLocalStorage ( ) ;
39853993
3994+ currentProject . nativePalettes = null ;
3995+
39863996 // Set the UI state
39873997 updatePaletteLists ( ) ;
39883998}
@@ -4022,6 +4032,8 @@ function changePaletteTitle(paletteIndex, newTitle) {
40224032
40234033 state . saveToLocalStorage ( ) ;
40244034
4035+ currentProject . nativePalettes = null ;
4036+
40254037 paletteEditor . setState ( {
40264038 paletteList : getRenderPaletteList ( ) ,
40274039 displayNative : getUIState ( ) . displayNativeColour
@@ -4037,6 +4049,8 @@ function changePaletteSystem(paletteIndex, system) {
40374049 const palette = getPaletteList ( ) . getPalette ( paletteIndex ) ;
40384050 palette . system = system ;
40394051
4052+ currentProject . nativePalettes = null ;
4053+
40404054 state . saveToLocalStorage ( ) ;
40414055
40424056 paletteEditor . setState ( {
@@ -4076,7 +4090,7 @@ function changePaletteEditorDisplayNativeColours(displayNative) {
40764090}
40774091
40784092function updateTileEditorGridColours ( ) {
4079- const isGameboyProject = getUIState ( ) . displayNativeColour && getProject ( ) . systemType === 'gb' ;
4093+ const isGameboyProject = getUIState ( ) . displayNativeColour && getProject ( ) ? .systemType === 'gb' ;
40804094 tileEditor . setState ( {
40814095 pixelGridColour : ( isGameboyProject ) ? '#98a200' : '#000000' ,
40824096 pixelGridOpacity : ( isGameboyProject ) ? 0.5 : 0.2 ,
@@ -4118,6 +4132,8 @@ function swapColourIndex(sourceColourIndex, targetColourIndex) {
41184132
41194133 state . saveToLocalStorage ( ) ;
41204134
4135+ currentProject . nativePalettes = null ;
4136+
41214137 tileEditor . setState ( {
41224138 paletteList : getRenderPaletteListToSuitTileMapOrTileSetSelection ( ) ,
41234139 tileGrid : getTileGrid ( ) ,
@@ -5581,7 +5597,7 @@ window.addEventListener('load', async () => {
55815597 } ) ;
55825598
55835599 welcomeScreen . setState ( {
5584- version : versionInfo ,
5600+ version : versionInfo ,
55855601 channel : channelInfo
55865602 } ) ;
55875603
0 commit comments