Skip to content

Commit

Permalink
sending data back to 3d after changing it
Browse files Browse the repository at this point in the history
  • Loading branch information
tdev committed Oct 14, 2024
1 parent 8b1f347 commit 3313453
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/dataUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const sjsonParser = require('./json/sjsonParser');
* message.nodes - The array of nodes with updated position values.
* message.uri - The URI of the document being edited.
*/
async function updateJbeamNodeData(message) {
async function updateJbeamNodeData(message, updateDataCallback) {
//console.log("updateNode from 3d", message.nodes);

// Sort nodes to ensure replacements are done from bottom to top and right to left
Expand Down Expand Up @@ -72,7 +72,7 @@ async function updateJbeamNodeData(message) {
}

replaceValue(dataBundle.metaData[startIdx + 2], node.pos[0])
replaceValue(dataBundle.metaData[startIdx + 3], node.pos[2])
replaceValue(dataBundle.metaData[startIdx + 3], -node.pos[2])
replaceValue(dataBundle.metaData[startIdx + 4], node.pos[1])
}
});
Expand All @@ -90,6 +90,8 @@ async function updateJbeamNodeData(message) {
);
}
}
updateDataCallback(targetEditor)
return true
}

module.exports = {
Expand Down
4 changes: 3 additions & 1 deletion src/threeDPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ function show3DSceneCommand() {
//console.log('ext.onDidReceiveMessage', message)
switch (message.command) {
case 'updateJBeamNodesAST':
dataUpdater.updateJbeamNodeData(message)
dataUpdater.updateJbeamNodeData(message, (targetEditor)=> {
parseAndPostData(targetEditor)
})
break
case 'selectLine':
if(message.origin) {
Expand Down

0 comments on commit 3313453

Please sign in to comment.