@@ -10,9 +10,13 @@ local m_max = math.max
1010local PassiveSpecListClass = newClass (" PassiveSpecListControl" , " ListControl" , function (self , anchor , rect , treeTab )
1111 self .ListControl (anchor , rect , 16 , " VERTICAL" , true , treeTab .specList )
1212 self .treeTab = treeTab
13- self .controls .copy = new (" ButtonControl" , {" BOTTOMLEFT" ,self ," TOP" }, {2 , - 4 , 60 , 18 }, " Copy" , function ()
14- local newSpec = treeTab :CopyTree (self .selIndex )
15- self :RenameSpec (newSpec , " Copy Tree" )
13+ self .controls .copy = new (" ButtonControl" , { " BOTTOMLEFT" , self , " TOP" }, { 2 , - 4 , 60 , 18 }, " Copy" , function ()
14+ local newSpec = new (" PassiveSpec" , treeTab .build , self .selValue .treeVersion )
15+ newSpec .title = self .selValue .title
16+ newSpec .jewels = copyTable (self .selValue .jewels )
17+ newSpec :RestoreUndoState (self .selValue :CreateUndoState ())
18+ newSpec :BuildClusterJewelGraphs ()
19+ self :RenameSpec (newSpec , " Copy Tree" , true )
1620 end )
1721 self .controls .copy .enabled = function ()
1822 return self .selValue ~= nil
@@ -31,6 +35,7 @@ local PassiveSpecListClass = newClass("PassiveSpecListControl", "ListControl", f
3135 end
3236 self .controls .new = new (" ButtonControl" , {" RIGHT" ,self .controls .rename ," LEFT" }, {- 4 , 0 , 60 , 18 }, " New" , function ()
3337 local newSpec = new (" PassiveSpec" , treeTab .build , latestTreeVersion )
38+ newSpec .title = " New Tree"
3439 newSpec :SelectClass (treeTab .build .spec .curClassId )
3540 newSpec :SelectAscendClass (treeTab .build .spec .curAscendClassId )
3641 newSpec :SelectSecondaryAscendClass (treeTab .build .spec .curSecondaryAscendClassId )
4247function PassiveSpecListClass :RenameSpec (spec , popupTitle , addOnName )
4348 local controls = { }
4449 controls .label = new (" LabelControl" , nil , {0 , 20 , 0 , 16 }, " ^7Enter name for this passive tree:" )
45- controls .edit = new (" EditControl" , nil , {0 , 40 , 350 , 20 }, spec .title , nil , nil , 100 , function (buf )
50+ controls .edit = new (" EditControl" , nil , {0 , 40 , 350 , 20 }, spec .title or " Default " , nil , nil , 100 , function (buf )
4651 controls .save .enabled = buf :match (" %S" )
4752 end )
4853 controls .save = new (" ButtonControl" , nil , {- 45 , 70 , 80 , 20 }, " Save" , function ()
0 commit comments