Skip to content

Commit

Permalink
Fix initial layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ty-v1 committed Feb 5, 2019
1 parent 1166596 commit 248f916
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/D3JS/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
height: this.contentHeight
}
});
this.$store.commit('Layout')
}
}
</script>
Expand Down
17 changes: 11 additions & 6 deletions src/store/LayoutStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ const mutations = {
const svgWidth: number = state.layout.width + 40;
const svgHeight: number = state.layout.height + 40;

state.size = {
width: payload.content.width,
height: payload.content.height
};
state.scale = 1;
state.viewBox = {
minX: 0,
minY: 0,
width: payload.content.width,
height: payload.content.height
width: state.size.width,
height: state.size.height
};
},

Expand All @@ -93,8 +98,8 @@ const mutations = {
state.viewBox = {
minX: 0,
minY: 0,
width: payload.content.width,
height: payload.content.height
width: state.size.width,
height: state.size.height
};
},

Expand All @@ -103,8 +108,8 @@ const mutations = {
state.scale = scale;

// ズームを行う
const width: number = state.layout.width + 40;
const height: number = state.layout.height + 40;
const width: number = state.size.width;
const height: number = state.size.height;
// 大きさをscale倍する
const zoomedWidth = width / scale;
const zoomedHeight = height / scale;
Expand Down

0 comments on commit 248f916

Please sign in to comment.