diff --git a/src/components/objects/ContentBlock.vue b/src/components/objects/ContentBlock.vue
index 449ab0a..3eb271e 100644
--- a/src/components/objects/ContentBlock.vue
+++ b/src/components/objects/ContentBlock.vue
@@ -41,7 +41,7 @@
diff --git a/src/components/objects/Project.vue b/src/components/objects/Project.vue
index 0823b5d..485de1c 100644
--- a/src/components/objects/Project.vue
+++ b/src/components/objects/Project.vue
@@ -12,39 +12,31 @@
diff --git a/src/store/modules/project.js b/src/store/modules/project.js
index de56a9c..82816d6 100644
--- a/src/store/modules/project.js
+++ b/src/store/modules/project.js
@@ -38,7 +38,8 @@ export default {
paddingZ: 0
},
contents: {},
- grid: []
+ grid: [],
+ gridContentPlaced: {}
},
// getters
@@ -77,7 +78,15 @@ export default {
setFloor3dObj: (state, obj) => { state.floor3dObj = obj },
setFloorPos: (state, pos) => { state.floorPos = pos },
setTopColor: (state, col) => { state.topColor = col },
- setFloorColor: (state, col) => { state.floorColor = col }
+ setFloorColor: (state, col) => { state.floorColor = col },
+ setContents: (state, contents) => { state.contents = contents },
+ shiftGrid: (state, c) => {
+ let p = state.grid.shift()
+ if (!state.gridContentPlaced[c.type]) {
+ state.gridContentPlaced[c.type] = {}
+ }
+ state.gridContentPlaced[c.type][c.id] = p
+ }
},
// actions
@@ -142,34 +151,33 @@ export default {
state.wall.paddingY = (state.size.y - 2 * state.wall.margin - state.wall.winH * state.wall.nbrWinY) / (state.wall.nbrWinY - 1)
a++
}
- // state.wall = { ...wall }
- //
- // // CONTENTS GRID
- // a = 0
- // state.wall.nbrWinZ = Math.floor((state.size.z - 2 * state.wall.margin) / state.wall.winW)
- // while (state.wall.paddingZ < 0.4) {
- // state.wall.nbrWinZ -= a
- // state.wall.paddingZ = (state.size.z - 2 * state.wall.margin - state.wall.winW * state.wall.nbrWinZ) / (state.wall.nbrWinZ - 1)
- // a++
- // }
- //
- // grid = []
- // for (var l = 0; l < state.wall.nbrWinZ * 2; l++) { // cols
- // for (var m = 0; m < state.wall.nbrWinY * 2; m++) { // rows
- // grid.push({
- // z: margin + state.wall.winW / 2 * l,
- // y: margin + state.wall.winH / 2 * m
- // })
- // }
- // }
- // // shuffle the grid
- // for (let n = grid.length - 1; n > 0; n--) {
- // const o = Math.floor(Math.random() * n)
- // const temp = grid[n]
- // grid[n] = grid[o]
- // grid[o] = temp
- // }
- // state.grid = [ ...grid ]
+
+ // CONTENTS GRID
+ a = 0
+ state.wall.nbrWinZ = Math.floor((state.size.z - 2 * state.wall.margin) / state.wall.winW)
+ while (state.wall.paddingZ < 0.4) {
+ state.wall.nbrWinZ -= a
+ state.wall.paddingZ = (state.size.z - 2 * state.wall.margin - state.wall.winW * state.wall.nbrWinZ) / (state.wall.nbrWinZ - 1)
+ a++
+ }
+
+ let grid = []
+ for (var l = 0; l < state.wall.nbrWinZ * 2; l++) { // cols
+ for (var m = 0; m < state.wall.nbrWinY * 2; m++) { // rows
+ grid.push({
+ z: margin + state.wall.winW / 2 * l,
+ y: margin + state.wall.winH / 2 * m
+ })
+ }
+ }
+ // shuffle the grid
+ for (let n = grid.length - 1; n > 0; n--) {
+ const o = Math.floor(Math.random() * n)
+ const temp = grid[n]
+ grid[n] = grid[o]
+ grid[o] = temp
+ }
+ state.grid = [ ...grid ]
},
build3dObjs ({ dispatch, commit, state, getters, rootGetters }) {
console.log('build3dObjs')
@@ -299,9 +307,10 @@ export default {
},
loadContents ({ dispatch, commit, state }) {
console.log('loadContents')
+ // (where: { Published: "true" })
GRAPHQL.post('', { query: `query {
project(id: "${state.id}") {
- visibles(where: { Published: "true" }){
+ visibles{
id
Name
Media {
@@ -313,7 +322,7 @@ export default {
Url
categories
}
- contexts(where: { Published: "true" }){
+ contexts{
id
Name
Images {
@@ -324,7 +333,7 @@ export default {
Vimeo
Url
}
- processes(where: { Published: "true" }){
+ processes{
id
Name
Media {
@@ -335,7 +344,7 @@ export default {
Vimeo
Url
}
- concepts(where: { Published: "true" }){
+ concepts{
id
Name
Images {
@@ -348,7 +357,8 @@ export default {
}
}` })
.then(({ data: { data: { project } = null } }) => {
- console.log('graphql visibles', project)
+ console.log('graphql contents', project)
+ commit('setContents', project)
// dispatch('computeProjects', projects)
})
.catch((error) => {
@@ -356,5 +366,10 @@ export default {
Promise.reject(error)
})
}
+ // getGridPos ({ state, commit }) {
+ // let p = state.grid[0]
+ // commit('shiftGrid')
+ // Promise.resolve(p)
+ // }
}
}
diff --git a/src/store/modules/projects.js b/src/store/modules/projects.js
index 6abbe99..aea48ea 100644
--- a/src/store/modules/projects.js
+++ b/src/store/modules/projects.js
@@ -24,11 +24,6 @@ export default {
projectID: (state) => (index) => {
// console.log('getter projectID index', index)
return state.projects[index].id
- },
- getGridPos: (state) => (index) => {
- let popped = state.projects[index].grid.pop()
- // console.log('getGridPos: popped', popped)
- return popped
}
},