mirror of
https://github.com/igorski/bitmappery.git
synced 2026-06-16 19:25:38 +02:00
Upon opening a new Document, there is always a valid tool selected
This commit is contained in:
@@ -131,6 +131,9 @@ export default {
|
||||
flushBitmapCache();
|
||||
layerPool.clear();
|
||||
this.calcIdealDimensions();
|
||||
this.$nextTick(() => {
|
||||
this.setActiveTool({ tool: this.activeTool || ToolTypes.MOVE, layer: this.activeLayer });
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -204,6 +207,7 @@ export default {
|
||||
...mapMutations([
|
||||
"setZCanvasBaseDimensions",
|
||||
"setPanMode",
|
||||
"setActiveTool",
|
||||
]),
|
||||
...mapActions([
|
||||
"requestDocumentClose",
|
||||
|
||||
@@ -61,7 +61,8 @@ export default {
|
||||
addNewDocument( state, nameOrDocument ) {
|
||||
const document = typeof nameOrDocument === "object" ? nameOrDocument : DocumentFactory.create({ name: nameOrDocument });
|
||||
state.documents.push( document );
|
||||
state.activeIndex = state.documents.length - 1;
|
||||
state.activeIndex = state.documents.length - 1;
|
||||
state.activeLayerIndex = document.layers.length - 1;
|
||||
},
|
||||
closeActiveDocument( state ) {
|
||||
const document = state.documents[ state.activeIndex ];
|
||||
|
||||
@@ -151,10 +151,14 @@ describe( "Vuex document module", () => {
|
||||
it( "should be able to add a new Document to the list", () => {
|
||||
const state = {
|
||||
documents: [ { name: "foo" } ],
|
||||
activeIndex: 0,
|
||||
activeLayerIndex: 2,
|
||||
};
|
||||
mutations.addNewDocument( state, "bar" );
|
||||
expect( state.documents ).toHaveLength( 2 );
|
||||
expect( state.documents[ 1 ].name ).toEqual( "bar" );
|
||||
expect( state.activeIndex ).toEqual( 1 );
|
||||
expect( state.activeLayerIndex ).toEqual( 0 );
|
||||
});
|
||||
|
||||
it( "should be able to close the active Document", () => {
|
||||
|
||||
Reference in New Issue
Block a user