diff --git a/src/components/D3JS/Basic.vue b/src/components/D3JS/Basic.vue index b627f87..69550cc 100644 --- a/src/components/D3JS/Basic.vue +++ b/src/components/D3JS/Basic.vue @@ -232,6 +232,7 @@ height: this.contentHeight } }); + this.$store.commit('Layout') } } diff --git a/src/store/LayoutStore.ts b/src/store/LayoutStore.ts index aa9a3b4..a8a3ad3 100644 --- a/src/store/LayoutStore.ts +++ b/src/store/LayoutStore.ts @@ -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 }; }, @@ -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 }; }, @@ -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;