Add two-way tool option messaging system between frontend/backend (#361)

* Add two-way tool option messaging system

* Rename tool option functions

* Move repeated frontend messaging code to function

* Address style comments

* Rename variable to be more descriptive

* Move tool options update to SetActiveTool message

* Refactor record of all tool options

* Only pass active tool options to bar

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Henry Sloan
2021-08-29 00:43:27 -04:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent 05ac4ac9b8
commit 9e73cce281
7 changed files with 59 additions and 32 deletions
+6 -2
View File
@@ -6,7 +6,7 @@
<Separator :type="SeparatorType.Section" />
<ToolOptions :activeTool="activeTool" />
<ToolOptions :activeTool="activeTool" :activeToolOptions="activeToolOptions" />
</div>
<div class="spacer"></div>
<div class="right side">
@@ -330,7 +330,10 @@ export default defineComponent({
registerResponseHandler(ResponseType.SetActiveTool, (responseData: Response) => {
const toolData = responseData as SetActiveTool;
if (toolData) this.activeTool = toolData.tool_name;
if (toolData) {
this.activeTool = toolData.tool_name;
this.activeToolOptions = toolData.tool_options;
}
});
registerResponseHandler(ResponseType.SetCanvasZoom, (responseData: Response) => {
@@ -357,6 +360,7 @@ export default defineComponent({
canvasSvgWidth: "100%",
canvasSvgHeight: "100%",
activeTool: "Select",
activeToolOptions: {},
documentModeEntries,
viewModeEntries,
documentModeSelectionIndex: 0,