diff --git a/app/assets/json/global/services.json b/app/assets/json/global/services.json index ad332e9..c83d619 100644 --- a/app/assets/json/global/services.json +++ b/app/assets/json/global/services.json @@ -17,10 +17,18 @@ } }, "/keyframes": { - "save": { - "uri": "/api/keyframes/{id}", + "create": { + "uri": "/api/keyframes", + "method": "PUT" + }, + "rename": { + "uri": "/api/keyframes/{kfId}", + "method": "PUT" + }, + "saveAgents": { + "uri": "/api/keyframes/{kfId}/agents", "method": "PUT" } - } + } } } diff --git a/app/controllers/editors/EditorsController.js b/app/controllers/editors/EditorsController.js index 8f2a7b9..ba4bbe6 100644 --- a/app/controllers/editors/EditorsController.js +++ b/app/controllers/editors/EditorsController.js @@ -12,7 +12,8 @@ class EditorsController extends WindozController { async keyframe() { const models = { - agents : new AgentsModel('/agents') + agents : new AgentsModel('/agents'), + keyframes : new KeyframesModel('/keyframes') } this.loadWindow( diff --git a/app/models/KeyframesModel.js b/app/models/KeyframesModel.js index 8af5f36..0d334a7 100644 --- a/app/models/KeyframesModel.js +++ b/app/models/KeyframesModel.js @@ -5,7 +5,21 @@ class KeyframesModel extends WindozModel { this.ressource = '/keyframes' } - async save(data) { + async create(kfData, prevKFId) { + let endpoint = {...app.config.api[this.ressource].create} + return ( + this.request(endpoint.uri, endpoint.method, kfData) + ) + } + + async rename(kfData, prevKFId) { + let endpoint = {...app.config.api[this.ressource].create} + return ( + this.request(endpoint.uri, endpoint.method, kfData) + ) + } + + async save(kfId, data) { const kfData = Object.keys(data).map(aid => { const { position, speed, ...storeValues} = data[aid].values return({ @@ -15,9 +29,8 @@ class KeyframesModel extends WindozModel { }) }) - let endpoint = {...app.config.api[this.ressource].getTypes} - endpoint.uri = endpoint.uri.replace('{family}', data.kfId || '') - const aid = Object.keys(x)[data] + let endpoint = {...app.config.api[this.ressource].saveAgents} + endpoint.uri = endpoint.uri.replace('{kfId}', kfId) return ( this.request(endpoint.uri, endpoint.method, kfData) ) diff --git a/app/views/editors/KeyframeView.html b/app/views/editors/KeyframeView.html index 78176a4..14ac1fc 100644 --- a/app/views/editors/KeyframeView.html +++ b/app/views/editors/KeyframeView.html @@ -17,7 +17,7 @@ } .kf-editor article.agent-properties section{ display: grid; - grid-template-rows: 2em 3em auto; + grid-template-rows: 2em 2em auto; overflow: visible; height:100%; } @@ -53,11 +53,14 @@ padding: 0 0 0 0; min-height: 1.2em; } - .kf-editor article.agent-properties section.kf-actions { border-top: 1px solid #473; padding: 3px 5px 3px 5px; height:3em;} + .kf-editor article.agent-properties section.kf-actions { + border-top: 1px solid #473; + padding: 3px 5px 3px 5px; + height:8em; + } .kf-editor article.agent-properties section.kf-actions button{ color: #DDD; padding: 0 0 0 0; - min-height: 2em; } .kf-editor button[data-trigger="onAddAgent"] { background-color: #473; } .kf-editor button[data-trigger="onRemoveAgent"] { background-color: #A00; } @@ -99,9 +102,13 @@
-