From 41bead9028b240e16a69e19cc9b97f4cb29158a3 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Thu, 11 Aug 2022 17:20:10 -0700 Subject: [PATCH] Rename MovementMessage to NavigationMessage --- editor/graphite-test-document.graphite | 2 +- editor/src/consts.rs | 2 +- editor/src/dispatcher.rs | 4 +- .../messages/input_mapper/default_mapping.rs | 44 +++++++++---------- .../portfolio/document/document_message.rs | 2 +- .../document/document_message_handler.rs | 42 +++++++++--------- editor/src/messages/portfolio/document/mod.rs | 2 +- .../portfolio/document/movement/mod.rs | 7 --- .../portfolio/document/navigation/mod.rs | 7 +++ .../navigation_message.rs} | 4 +- .../navigation_message_handler.rs} | 18 ++++---- .../portfolio/portfolio_message_handler.rs | 6 +-- editor/src/messages/prelude.rs | 2 +- .../tool/tool_messages/navigate_tool.rs | 18 ++++---- frontend/wasm/src/editor_api.rs | 4 +- 15 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 editor/src/messages/portfolio/document/movement/mod.rs create mode 100644 editor/src/messages/portfolio/document/navigation/mod.rs rename editor/src/messages/portfolio/document/{movement/movement_message.rs => navigation/navigation_message.rs} (91%) rename editor/src/messages/portfolio/document/{movement/movement_message_handler.rs => navigation/navigation_message_handler.rs} (95%) diff --git a/editor/graphite-test-document.graphite b/editor/graphite-test-document.graphite index 2fa78b2d..04888de7 100644 --- a/editor/graphite-test-document.graphite +++ b/editor/graphite-test-document.graphite @@ -1 +1 @@ -{"graphene_document":{"root":{"visible":true,"name":null,"data":{"Folder":{"next_assignment_id":5985789465543063412,"layer_ids":[3526279254690554630,14455049941182576981,2264120728080545131,11029257369377086983,11600227885950905622,5985789465543063411],"layers":[{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[0.5,1.0],"manipulator_type":"Anchor"},{"position":[0.7761415,1.0],"manipulator_type":"InHandle"},{"position":[0.22385850000000002,1.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.0,0.5],"manipulator_type":"Anchor"},{"position":[0.0,0.7761415],"manipulator_type":"InHandle"},{"position":[0.0,0.22385850000000002],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.5,0.0],"manipulator_type":"Anchor"},{"position":[0.22385850000000002,0.0],"manipulator_type":"InHandle"},{"position":[0.7761415,0.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[1.0,0.5],"manipulator_type":"Anchor"},{"position":[1.0,0.22385850000000002],"manipulator_type":"InHandle"},{"position":[1.0,0.7761415],"manipulator_type":"OutHandle"}]},{"points":[null,null,null]}],"element_ids":[1,2,3,4,5]},"style":{"stroke":null,"fill":{"Solid":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}}},"render_index":1}},"transform":{"matrix2":[369.0,0.0,-0.0,480.0],"translation":[-927.566650390625,-365.5]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[-865.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-864.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-854.566650390625,-427.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-832.566650390625,-429.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-793.566650390625,-433.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-743.566650390625,-435.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-682.566650390625,-435.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-615.566650390625,-437.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-560.566650390625,-439.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-509.566650390625,-435.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-480.566650390625,-429.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-453.566650390625,-417.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-419.566650390625,-398.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-379.566650390625,-376.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-356.566650390625,-359.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-335.566650390625,-339.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-325.566650390625,-319.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-312.566650390625,-288.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-304.566650390625,-257.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-299.566650390625,-225.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-298.566650390625,-205.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-298.566650390625,-182.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-298.566650390625,-163.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-299.566650390625,-141.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-304.566650390625,-113.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-308.566650390625,-87.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-311.566650390625,-67.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-314.566650390625,-48.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-316.566650390625,-35.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-322.566650390625,-17.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-326.566650390625,-5.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-334.566650390625,14.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-338.566650390625,27.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-345.566650390625,45.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-348.566650390625,55.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-354.566650390625,70.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-360.566650390625,83.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-365.566650390625,91.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-369.566650390625,98.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-375.566650390625,106.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-381.566650390625,114.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-385.566650390625,122.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-394.566650390625,130.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-402.566650390625,137.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-409.566650390625,142.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-417.566650390625,148.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-426.566650390625,154.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-437.566650390625,161.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-451.566650390625,166.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-468.566650390625,175.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-483.566650390625,181.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-507.566650390625,188.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-527.566650390625,193.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-552.566650390625,197.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-576.566650390625,200.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-605.566650390625,201.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-631.566650390625,201.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-661.566650390625,201.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-691.566650390625,200.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-724.566650390625,198.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-751.566650390625,195.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-778.566650390625,191.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-797.566650390625,190.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-832.566650390625,187.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-857.566650390625,183.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-897.566650390625,176.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-925.566650390625,171.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-964.566650390625,160.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-985.566650390625,152.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1010.566650390625,143.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1022.566650390625,137.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1029.566650390625,133.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1036.566650390625,127.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1042.566650390625,117.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1047.566650390625,98.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1051.566650390625,70.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1058.566650390625,37.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1062.566650390625,5.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-37.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1076.566650390625,-84.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1076.566650390625,-130.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1071.566650390625,-180.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-206.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-230.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-247.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1066.566650390625,-272.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1065.566650390625,-291.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1062.566650390625,-315.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1059.566650390625,-328.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1058.566650390625,-337.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1055.566650390625,-348.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1049.566650390625,-360.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1041.566650390625,-377.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1033.566650390625,-393.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1024.566650390625,-407.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1020.566650390625,-413.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1015.566650390625,-418.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1001.566650390625,-430.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-990.566650390625,-436.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-977.566650390625,-441.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-967.566650390625,-444.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-959.566650390625,-444.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-952.566650390625,-444.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-933.566650390625,-442.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-905.566650390625,-436.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-889.566650390625,-432.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-880.566650390625,-430.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-877.566650390625,-429.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-876.566650390625,-428.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-874.566650390625,-426.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-870.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-869.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-867.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-865.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-861.566650390625,-425.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-857.566650390625,-426.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-853.566650390625,-427.5],"manipulator_type":"Anchor"},null,null]}],"element_ids":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117]},"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":5.0,"dash_lengths":[0.0],"dash_offset":0.0,"line_cap":"Butt","line_join":"Miter","line_join_miter_limit":4.0},"fill":"None"},"render_index":0}},"transform":{"matrix2":[1.0,0.0,0.0,1.0],"translation":[0.0,0.0]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[0.5,1.0],"manipulator_type":"Anchor"},{"position":[0.7761415,1.0],"manipulator_type":"InHandle"},{"position":[0.22385850000000002,1.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.0,0.5],"manipulator_type":"Anchor"},{"position":[0.0,0.7761415],"manipulator_type":"InHandle"},{"position":[0.0,0.22385850000000002],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.5,0.0],"manipulator_type":"Anchor"},{"position":[0.22385850000000002,0.0],"manipulator_type":"InHandle"},{"position":[0.7761415,0.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[1.0,0.5],"manipulator_type":"Anchor"},{"position":[1.0,0.22385850000000002],"manipulator_type":"InHandle"},{"position":[1.0,0.7761415],"manipulator_type":"OutHandle"}]},{"points":[null,null,null]}],"element_ids":[1,2,3,4,5]},"style":{"stroke":null,"fill":{"Solid":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}}},"render_index":1}},"transform":{"matrix2":[337.94872665058745,-35.51369323805279,47.56585157675848,452.6372085455832],"translation":[92.9195736497411,-415.17298085605853]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[-48.69253069314482,-159.10513506221514],"manipulator_type":"Anchor"},null,{"position":[-70.52138079035899,-513.9526137439627],"manipulator_type":"OutHandle"}]},{"points":[{"position":[222.83237058696454,-503.0361992753027],"manipulator_type":"Anchor"},{"position":[-158.90270804291185,-442.8223058399684],"manipulator_type":"InHandle"},{"position":[604.5674492168409,-563.250092710637],"manipulator_type":"OutHandle"}]},{"points":[{"position":[664.0813704731281,-320.5874513553998],"manipulator_type":"Anchor"},{"position":[669.902428975468,-471.1676241628193],"manipulator_type":"InHandle"},{"position":[658.2603119707883,-170.00727854798032],"manipulator_type":"OutHandle"}]},{"points":[{"position":[561.9483011516083,149.32709051135873],"manipulator_type":"Anchor"},{"position":[779.4132177618326,129.56669690727574],"manipulator_type":"InHandle"},{"position":[344.4833845413841,169.08748411544173],"manipulator_type":"OutHandle"}]},{"points":[{"position":[-68.1412419353403,141.32950801660445],"manipulator_type":"Anchor"},{"position":[-11.996778942496576,322.5035681388116],"manipulator_type":"InHandle"},{"position":[-98.31104242698265,43.97377680505987],"manipulator_type":"OutHandle"}]},{"points":[{"position":[-49.90031956271264,-155.88608010049916],"manipulator_type":"Anchor"},{"position":[-49.90031956271264,-155.88608010049916],"manipulator_type":"InHandle"},{"position":[-49.90031956271264,-155.88608010049916],"manipulator_type":"OutHandle"}]}],"element_ids":[1,2,3,4,5,6]},"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":5.0,"dash_lengths":[0.0],"dash_offset":0.0,"line_cap":"Butt","line_join":"Miter","line_join_miter_limit":4.0},"fill":"None"},"render_index":1}},"transform":{"matrix2":[1.0,0.0,0.0,1.0],"translation":[0.0,0.0]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[-851.5216124852599,440.1011734805685],"manipulator_type":"Anchor"},null,{"position":[-745.4998088356991,742.8112831395855],"manipulator_type":"OutHandle"}]},{"points":[{"position":[90.98724947544201,508.0318434771365],"manipulator_type":"Anchor"},{"position":[-127.65914203173338,840.2218480977616],"manipulator_type":"InHandle"},{"position":[90.98724947544201,508.0318434771365],"manipulator_type":"OutHandle"}]}],"element_ids":[1,2]},"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":5.0,"dash_lengths":[0.0],"dash_offset":0.0,"line_cap":"Butt","line_join":"Miter","line_join_miter_limit":4.0},"fill":"None"},"render_index":1}},"transform":{"matrix2":[1.0,0.0,0.0,1.0],"translation":[0.0,0.0]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Text":{"text":"ein Fisch","path_style":{"stroke":null,"fill":{"Solid":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}}},"size":24.0,"line_width":null,"font":{"font_family":"Metal Mania","font_style":"Normal (400)"}}},"transform":{"matrix2":[17.266988107524366,-1.8145193943273525,1.814519394327352,17.266988107524366],"translation":[-884.6986699020281,-831.9173312579314]},"blend_mode":"Normal","opacity":1.0}]}},"transform":{"matrix2":[0.42065729978864125,0.0442052096218941,-0.0442052096218941,0.42065729978864125],"translation":[991.1799052249601,406.7405332186784]},"blend_mode":"Normal","opacity":1.0}},"saved_document_identifier":1812026093844533227,"name":"Untitled Document","version":"0.0.10","document_mode":"DesignMode","view_mode":"Normal","snapping_enabled":true,"overlays_visible":true,"layer_metadata":[[[3526279254690554630],{"selected":false,"expanded":false}],[[14455049941182576981],{"selected":false,"expanded":false}],[[2264120728080545131],{"selected":false,"expanded":false}],[[],{"selected":false,"expanded":true}],[[11600227885950905622],{"selected":false,"expanded":false}],[[5985789465543063411],{"selected":false,"expanded":false}],[[11029257369377086983],{"selected":false,"expanded":false}]],"layer_range_selection_reference":[],"movement_handler":{"pan":[172.02008130552463,39.54846254599968],"panning":false,"snap_tilt":false,"snap_tilt_released":false,"tilt":0.10470175813131441,"tilting":false,"zoom":0.4229735977849993,"zooming":false,"snap_zoom":false,"mouse_position":[1485.0,319.0]},"artboard_message_handler":{"artboards_graphene_document":{"root":{"visible":true,"name":null,"data":{"Folder":{"next_assignment_id":0,"layer_ids":[],"layers":[]}},"transform":{"matrix2":[0.42065729978864125,0.0442052096218941,-0.0442052096218941,0.42065729978864125],"translation":[991.1799052249601,406.7405332186784]},"blend_mode":"Normal","opacity":1.0}},"artboard_ids":[]},"properties_panel_message_handler":{"active_selection":null}} +{"graphene_document":{"root":{"visible":true,"name":null,"data":{"Folder":{"next_assignment_id":5985789465543063412,"layer_ids":[3526279254690554630,14455049941182576981,2264120728080545131,11029257369377086983,11600227885950905622,5985789465543063411],"layers":[{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[0.5,1.0],"manipulator_type":"Anchor"},{"position":[0.7761415,1.0],"manipulator_type":"InHandle"},{"position":[0.22385850000000002,1.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.0,0.5],"manipulator_type":"Anchor"},{"position":[0.0,0.7761415],"manipulator_type":"InHandle"},{"position":[0.0,0.22385850000000002],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.5,0.0],"manipulator_type":"Anchor"},{"position":[0.22385850000000002,0.0],"manipulator_type":"InHandle"},{"position":[0.7761415,0.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[1.0,0.5],"manipulator_type":"Anchor"},{"position":[1.0,0.22385850000000002],"manipulator_type":"InHandle"},{"position":[1.0,0.7761415],"manipulator_type":"OutHandle"}]},{"points":[null,null,null]}],"element_ids":[1,2,3,4,5]},"style":{"stroke":null,"fill":{"Solid":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}}},"render_index":1}},"transform":{"matrix2":[369.0,0.0,-0.0,480.0],"translation":[-927.566650390625,-365.5]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[-865.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-864.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-854.566650390625,-427.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-832.566650390625,-429.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-793.566650390625,-433.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-743.566650390625,-435.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-682.566650390625,-435.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-615.566650390625,-437.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-560.566650390625,-439.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-509.566650390625,-435.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-480.566650390625,-429.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-453.566650390625,-417.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-419.566650390625,-398.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-379.566650390625,-376.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-356.566650390625,-359.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-335.566650390625,-339.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-325.566650390625,-319.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-312.566650390625,-288.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-304.566650390625,-257.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-299.566650390625,-225.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-298.566650390625,-205.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-298.566650390625,-182.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-298.566650390625,-163.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-299.566650390625,-141.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-304.566650390625,-113.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-308.566650390625,-87.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-311.566650390625,-67.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-314.566650390625,-48.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-316.566650390625,-35.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-322.566650390625,-17.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-326.566650390625,-5.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-334.566650390625,14.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-338.566650390625,27.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-345.566650390625,45.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-348.566650390625,55.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-354.566650390625,70.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-360.566650390625,83.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-365.566650390625,91.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-369.566650390625,98.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-375.566650390625,106.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-381.566650390625,114.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-385.566650390625,122.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-394.566650390625,130.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-402.566650390625,137.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-409.566650390625,142.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-417.566650390625,148.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-426.566650390625,154.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-437.566650390625,161.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-451.566650390625,166.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-468.566650390625,175.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-483.566650390625,181.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-507.566650390625,188.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-527.566650390625,193.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-552.566650390625,197.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-576.566650390625,200.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-605.566650390625,201.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-631.566650390625,201.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-661.566650390625,201.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-691.566650390625,200.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-724.566650390625,198.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-751.566650390625,195.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-778.566650390625,191.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-797.566650390625,190.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-832.566650390625,187.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-857.566650390625,183.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-897.566650390625,176.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-925.566650390625,171.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-964.566650390625,160.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-985.566650390625,152.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1010.566650390625,143.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1022.566650390625,137.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1029.566650390625,133.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1036.566650390625,127.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1042.566650390625,117.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1047.566650390625,98.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1051.566650390625,70.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1058.566650390625,37.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1062.566650390625,5.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-37.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1076.566650390625,-84.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1076.566650390625,-130.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1071.566650390625,-180.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-206.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-230.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1069.566650390625,-247.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1066.566650390625,-272.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1065.566650390625,-291.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1062.566650390625,-315.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1059.566650390625,-328.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1058.566650390625,-337.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1055.566650390625,-348.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1049.566650390625,-360.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1041.566650390625,-377.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1033.566650390625,-393.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1024.566650390625,-407.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1020.566650390625,-413.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1015.566650390625,-418.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-1001.566650390625,-430.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-990.566650390625,-436.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-977.566650390625,-441.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-967.566650390625,-444.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-959.566650390625,-444.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-952.566650390625,-444.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-933.566650390625,-442.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-905.566650390625,-436.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-889.566650390625,-432.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-880.566650390625,-430.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-877.566650390625,-429.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-876.566650390625,-428.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-874.566650390625,-426.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-870.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-869.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-867.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-865.566650390625,-424.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-861.566650390625,-425.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-857.566650390625,-426.5],"manipulator_type":"Anchor"},null,null]},{"points":[{"position":[-853.566650390625,-427.5],"manipulator_type":"Anchor"},null,null]}],"element_ids":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117]},"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":5.0,"dash_lengths":[0.0],"dash_offset":0.0,"line_cap":"Butt","line_join":"Miter","line_join_miter_limit":4.0},"fill":"None"},"render_index":0}},"transform":{"matrix2":[1.0,0.0,0.0,1.0],"translation":[0.0,0.0]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[0.5,1.0],"manipulator_type":"Anchor"},{"position":[0.7761415,1.0],"manipulator_type":"InHandle"},{"position":[0.22385850000000002,1.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.0,0.5],"manipulator_type":"Anchor"},{"position":[0.0,0.7761415],"manipulator_type":"InHandle"},{"position":[0.0,0.22385850000000002],"manipulator_type":"OutHandle"}]},{"points":[{"position":[0.5,0.0],"manipulator_type":"Anchor"},{"position":[0.22385850000000002,0.0],"manipulator_type":"InHandle"},{"position":[0.7761415,0.0],"manipulator_type":"OutHandle"}]},{"points":[{"position":[1.0,0.5],"manipulator_type":"Anchor"},{"position":[1.0,0.22385850000000002],"manipulator_type":"InHandle"},{"position":[1.0,0.7761415],"manipulator_type":"OutHandle"}]},{"points":[null,null,null]}],"element_ids":[1,2,3,4,5]},"style":{"stroke":null,"fill":{"Solid":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}}},"render_index":1}},"transform":{"matrix2":[337.94872665058745,-35.51369323805279,47.56585157675848,452.6372085455832],"translation":[92.9195736497411,-415.17298085605853]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[-48.69253069314482,-159.10513506221514],"manipulator_type":"Anchor"},null,{"position":[-70.52138079035899,-513.9526137439627],"manipulator_type":"OutHandle"}]},{"points":[{"position":[222.83237058696454,-503.0361992753027],"manipulator_type":"Anchor"},{"position":[-158.90270804291185,-442.8223058399684],"manipulator_type":"InHandle"},{"position":[604.5674492168409,-563.250092710637],"manipulator_type":"OutHandle"}]},{"points":[{"position":[664.0813704731281,-320.5874513553998],"manipulator_type":"Anchor"},{"position":[669.902428975468,-471.1676241628193],"manipulator_type":"InHandle"},{"position":[658.2603119707883,-170.00727854798032],"manipulator_type":"OutHandle"}]},{"points":[{"position":[561.9483011516083,149.32709051135873],"manipulator_type":"Anchor"},{"position":[779.4132177618326,129.56669690727574],"manipulator_type":"InHandle"},{"position":[344.4833845413841,169.08748411544173],"manipulator_type":"OutHandle"}]},{"points":[{"position":[-68.1412419353403,141.32950801660445],"manipulator_type":"Anchor"},{"position":[-11.996778942496576,322.5035681388116],"manipulator_type":"InHandle"},{"position":[-98.31104242698265,43.97377680505987],"manipulator_type":"OutHandle"}]},{"points":[{"position":[-49.90031956271264,-155.88608010049916],"manipulator_type":"Anchor"},{"position":[-49.90031956271264,-155.88608010049916],"manipulator_type":"InHandle"},{"position":[-49.90031956271264,-155.88608010049916],"manipulator_type":"OutHandle"}]}],"element_ids":[1,2,3,4,5,6]},"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":5.0,"dash_lengths":[0.0],"dash_offset":0.0,"line_cap":"Butt","line_join":"Miter","line_join_miter_limit":4.0},"fill":"None"},"render_index":1}},"transform":{"matrix2":[1.0,0.0,0.0,1.0],"translation":[0.0,0.0]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Shape":{"shape":{"elements":[{"points":[{"position":[-851.5216124852599,440.1011734805685],"manipulator_type":"Anchor"},null,{"position":[-745.4998088356991,742.8112831395855],"manipulator_type":"OutHandle"}]},{"points":[{"position":[90.98724947544201,508.0318434771365],"manipulator_type":"Anchor"},{"position":[-127.65914203173338,840.2218480977616],"manipulator_type":"InHandle"},{"position":[90.98724947544201,508.0318434771365],"manipulator_type":"OutHandle"}]}],"element_ids":[1,2]},"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":5.0,"dash_lengths":[0.0],"dash_offset":0.0,"line_cap":"Butt","line_join":"Miter","line_join_miter_limit":4.0},"fill":"None"},"render_index":1}},"transform":{"matrix2":[1.0,0.0,0.0,1.0],"translation":[0.0,0.0]},"blend_mode":"Normal","opacity":1.0},{"visible":true,"name":null,"data":{"Text":{"text":"ein Fisch","path_style":{"stroke":null,"fill":{"Solid":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}}},"size":24.0,"line_width":null,"font":{"font_family":"Metal Mania","font_style":"Normal (400)"}}},"transform":{"matrix2":[17.266988107524366,-1.8145193943273525,1.814519394327352,17.266988107524366],"translation":[-884.6986699020281,-831.9173312579314]},"blend_mode":"Normal","opacity":1.0}]}},"transform":{"matrix2":[0.42065729978864125,0.0442052096218941,-0.0442052096218941,0.42065729978864125],"translation":[991.1799052249601,406.7405332186784]},"blend_mode":"Normal","opacity":1.0}},"saved_document_identifier":1812026093844533227,"name":"Untitled Document","version":"0.0.11","document_mode":"DesignMode","view_mode":"Normal","snapping_enabled":true,"overlays_visible":true,"layer_metadata":[[[3526279254690554630],{"selected":false,"expanded":false}],[[14455049941182576981],{"selected":false,"expanded":false}],[[2264120728080545131],{"selected":false,"expanded":false}],[[],{"selected":false,"expanded":true}],[[11600227885950905622],{"selected":false,"expanded":false}],[[5985789465543063411],{"selected":false,"expanded":false}],[[11029257369377086983],{"selected":false,"expanded":false}]],"layer_range_selection_reference":[],"navigation_handler":{"pan":[172.02008130552463,39.54846254599968],"panning":false,"snap_tilt":false,"snap_tilt_released":false,"tilt":0.10470175813131441,"tilting":false,"zoom":0.4229735977849993,"zooming":false,"snap_zoom":false,"mouse_position":[1485.0,319.0]},"artboard_message_handler":{"artboards_graphene_document":{"root":{"visible":true,"name":null,"data":{"Folder":{"next_assignment_id":0,"layer_ids":[],"layers":[]}},"transform":{"matrix2":[0.42065729978864125,0.0442052096218941,-0.0442052096218941,0.42065729978864125],"translation":[991.1799052249601,406.7405332186784]},"blend_mode":"Normal","opacity":1.0}},"artboard_ids":[]},"properties_panel_message_handler":{"active_selection":null}} diff --git a/editor/src/consts.rs b/editor/src/consts.rs index 2185ec15..2ce4c2d4 100644 --- a/editor/src/consts.rs +++ b/editor/src/consts.rs @@ -74,5 +74,5 @@ pub const DEFAULT_FONT_FAMILY: &str = "Merriweather"; pub const DEFAULT_FONT_STYLE: &str = "Normal (400)"; // Document -pub const GRAPHITE_DOCUMENT_VERSION: &str = "0.0.10"; // Remember to save a simple document and replace the test file `graphite-test-document.graphite` +pub const GRAPHITE_DOCUMENT_VERSION: &str = "0.0.11"; // Remember to save a simple document and replace the test file `graphite-test-document.graphite` pub const VIEWPORT_ZOOM_TO_FIT_PADDING_SCALE_FACTOR: f32 = 1.05; diff --git a/editor/src/dispatcher.rs b/editor/src/dispatcher.rs index d0d4db5b..4ef99728 100644 --- a/editor/src/dispatcher.rs +++ b/editor/src/dispatcher.rs @@ -543,9 +543,9 @@ mod test { let print_problem_to_terminal_on_failure = |value: &String| { println!(); println!("-------------------------------------------------"); - println!("Failed test due to receiving a DisplayDialogError while loading the Graphite sample file!"); + println!("Failed test due to receiving a DisplayDialogError while loading the Graphite sample file."); println!("This is most likely caused by forgetting to bump the `GRAPHITE_DOCUMENT_VERSION` in `editor/src/consts.rs`"); - println!("After bumping this version number, please replace the `graphite-test-document.graphite` with a valid file [saved from the editor]."); + println!("After bumping this version number, replace `graphite-test-document.graphite` with a valid file by saving a document from the editor."); println!("DisplayDialogError details:"); println!(); println!("Description: {}", value); diff --git a/editor/src/messages/input_mapper/default_mapping.rs b/editor/src/messages/input_mapper/default_mapping.rs index 1d6cbf00..341b9433 100644 --- a/editor/src/messages/input_mapper/default_mapping.rs +++ b/editor/src/messages/input_mapper/default_mapping.rs @@ -20,11 +20,11 @@ pub fn default_mapping() -> Mapping { let mappings = mapping![ // HIGHER PRIORITY: // - // MovementMessage + // NavigationMessage entry!( PointerMove; refresh_keys=[Control], - action_dispatch=MovementMessage::PointerMove { snap_angle: Control, wait_for_snap_angle_release: true, snap_zoom: Control, zoom_from_viewport: None }, + action_dispatch=NavigationMessage::PointerMove { snap_angle: Control, wait_for_snap_angle_release: true, snap_zoom: Control, zoom_from_viewport: None }, ), // NORMAL PRIORITY: // @@ -264,32 +264,32 @@ pub fn default_mapping() -> Mapping { entry!(KeyDown(KeyR); action_dispatch=TransformLayerMessage::BeginRotate), entry!(KeyDown(KeyS); action_dispatch=TransformLayerMessage::BeginScale), // - // MovementMessage - entry!(KeyDown(Mmb); modifiers=[Control], action_dispatch=MovementMessage::RotateCanvasBegin), - entry!(KeyDown(Mmb); modifiers=[Shift], action_dispatch=MovementMessage::ZoomCanvasBegin), - entry!(KeyDown(Mmb); action_dispatch=MovementMessage::TranslateCanvasBegin), - entry!(KeyUp(Mmb); action_dispatch=MovementMessage::TransformCanvasEnd), - entry!(KeyDown(Lmb); modifiers=[Space], action_dispatch=MovementMessage::TranslateCanvasBegin), - entry!(KeyUp(Lmb); modifiers=[Space], action_dispatch=MovementMessage::TransformCanvasEnd), + // NavigationMessage + entry!(KeyDown(Mmb); modifiers=[Control], action_dispatch=NavigationMessage::RotateCanvasBegin), + entry!(KeyDown(Mmb); modifiers=[Shift], action_dispatch=NavigationMessage::ZoomCanvasBegin), + entry!(KeyDown(Mmb); action_dispatch=NavigationMessage::TranslateCanvasBegin), + entry!(KeyUp(Mmb); action_dispatch=NavigationMessage::TransformCanvasEnd), + entry!(KeyDown(Lmb); modifiers=[Space], action_dispatch=NavigationMessage::TranslateCanvasBegin), + entry!(KeyUp(Lmb); modifiers=[Space], action_dispatch=NavigationMessage::TransformCanvasEnd), entry_multiplatform!( - standard!(KeyDown(NumpadAdd); modifiers=[Control], action_dispatch=MovementMessage::IncreaseCanvasZoom { center_on_mouse: false }), - mac_only!(KeyDown(NumpadAdd); modifiers=[Command], action_dispatch=MovementMessage::IncreaseCanvasZoom { center_on_mouse: false }), + standard!(KeyDown(NumpadAdd); modifiers=[Control], action_dispatch=NavigationMessage::IncreaseCanvasZoom { center_on_mouse: false }), + mac_only!(KeyDown(NumpadAdd); modifiers=[Command], action_dispatch=NavigationMessage::IncreaseCanvasZoom { center_on_mouse: false }), ), entry_multiplatform!( - standard!(KeyDown(Equal); modifiers=[Control], action_dispatch=MovementMessage::IncreaseCanvasZoom { center_on_mouse: false }), - mac_only!(KeyDown(Equal); modifiers=[Command], action_dispatch=MovementMessage::IncreaseCanvasZoom { center_on_mouse: false }), + standard!(KeyDown(Equal); modifiers=[Control], action_dispatch=NavigationMessage::IncreaseCanvasZoom { center_on_mouse: false }), + mac_only!(KeyDown(Equal); modifiers=[Command], action_dispatch=NavigationMessage::IncreaseCanvasZoom { center_on_mouse: false }), ), entry_multiplatform!( - standard!(KeyDown(Minus); modifiers=[Control], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }), - mac_only!(KeyDown(Minus); modifiers=[Command], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }), + standard!(KeyDown(Minus); modifiers=[Control], action_dispatch=NavigationMessage::DecreaseCanvasZoom { center_on_mouse: false }), + mac_only!(KeyDown(Minus); modifiers=[Command], action_dispatch=NavigationMessage::DecreaseCanvasZoom { center_on_mouse: false }), ), - entry!(WheelScroll; modifiers=[Control], action_dispatch=MovementMessage::WheelCanvasZoom), - entry!(WheelScroll; modifiers=[Shift], action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: true }), - entry!(WheelScroll; action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: false }), - entry!(KeyDown(PageUp); modifiers=[Shift], action_dispatch=MovementMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(1., 0.) }), - entry!(KeyDown(PageDown); modifiers=[Shift], action_dispatch=MovementMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(-1., 0.) }), - entry!(KeyDown(PageUp); action_dispatch=MovementMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(0., 1.) }), - entry!(KeyDown(PageDown); action_dispatch=MovementMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(0., -1.) }), + entry!(WheelScroll; modifiers=[Control], action_dispatch=NavigationMessage::WheelCanvasZoom), + entry!(WheelScroll; modifiers=[Shift], action_dispatch=NavigationMessage::WheelCanvasTranslate { use_y_as_x: true }), + entry!(WheelScroll; action_dispatch=NavigationMessage::WheelCanvasTranslate { use_y_as_x: false }), + entry!(KeyDown(PageUp); modifiers=[Shift], action_dispatch=NavigationMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(1., 0.) }), + entry!(KeyDown(PageDown); modifiers=[Shift], action_dispatch=NavigationMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(-1., 0.) }), + entry!(KeyDown(PageUp); action_dispatch=NavigationMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(0., 1.) }), + entry!(KeyDown(PageDown); action_dispatch=NavigationMessage::TranslateCanvasByViewportFraction { delta: DVec2::new(0., -1.) }), // // PortfolioMessage entry_multiplatform!( diff --git a/editor/src/messages/portfolio/document/document_message.rs b/editor/src/messages/portfolio/document/document_message.rs index c9c450d4..e2486957 100644 --- a/editor/src/messages/portfolio/document/document_message.rs +++ b/editor/src/messages/portfolio/document/document_message.rs @@ -23,7 +23,7 @@ pub enum DocumentMessage { Artboard(ArtboardMessage), #[remain::unsorted] #[child] - Movement(MovementMessage), + Navigation(NavigationMessage), #[remain::unsorted] #[child] Overlays(OverlaysMessage), diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 523b29ba..7d4d9e38 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -51,7 +51,7 @@ pub struct DocumentMessageHandler { pub layer_metadata: HashMap, LayerMetadata>, layer_range_selection_reference: Vec, - movement_handler: MovementMessageHandler, + navigation_handler: NavigationMessageHandler, #[serde(skip)] overlays_message_handler: OverlaysMessageHandler, pub artboard_message_handler: ArtboardMessageHandler, @@ -79,7 +79,7 @@ impl Default for DocumentMessageHandler { layer_metadata: vec![(vec![], LayerMetadata::new(true))].into_iter().collect(), layer_range_selection_reference: Vec::new(), - movement_handler: MovementMessageHandler::default(), + navigation_handler: NavigationMessageHandler::default(), overlays_message_handler: OverlaysMessageHandler::default(), artboard_message_handler: ArtboardMessageHandler::default(), transform_layer_handler: TransformLayerMessageHandler::default(), @@ -134,8 +134,8 @@ impl MessageHandler { - self.movement_handler.process_message(message, (&self.graphene_document, ipp), responses); + Navigation(message) => { + self.navigation_handler.process_message(message, (&self.graphene_document, ipp), responses); } #[remain::unsorted] Overlays(message) => { @@ -504,7 +504,7 @@ impl MessageHandler { - responses.push_front(MovementMessage::SetCanvasZoom { zoom_factor: 1. }.into()); + responses.push_front(NavigationMessage::SetCanvasZoom { zoom_factor: 1. }.into()); } ZoomCanvasTo200Percent => { - responses.push_front(MovementMessage::SetCanvasZoom { zoom_factor: 2. }.into()); + responses.push_front(NavigationMessage::SetCanvasZoom { zoom_factor: 2. }.into()); } ZoomCanvasToFitAll => { if let Some(bounds) = self.document_bounds(font_cache) { responses.push_back( - MovementMessage::FitViewportToBounds { + NavigationMessage::FitViewportToBounds { bounds, padding_scale_factor: Some(VIEWPORT_ZOOM_TO_FIT_PADDING_SCALE_FACTOR), prevent_zoom_past_100: true, @@ -810,7 +810,7 @@ impl MessageHandler Self { let mut document = Self { name, ..Self::default() }; - let starting_root_transform = document.movement_handler.calculate_offset_transform(ipp.viewport_bounds.size() / 2.); + let starting_root_transform = document.navigation_handler.calculate_offset_transform(ipp.viewport_bounds.size() / 2.); document.graphene_document.root.transform = starting_root_transform; document.artboard_message_handler.artboards_graphene_document.root.transform = starting_root_transform; document @@ -1358,16 +1358,16 @@ impl DocumentMessageHandler { size: 24, icon: "ZoomIn".into(), tooltip: "Zoom In".into(), - tooltip_shortcut: action_keys!(MovementMessageDiscriminant::IncreaseCanvasZoom), - on_update: WidgetCallback::new(|_| MovementMessage::IncreaseCanvasZoom { center_on_mouse: false }.into()), + tooltip_shortcut: action_keys!(NavigationMessageDiscriminant::IncreaseCanvasZoom), + on_update: WidgetCallback::new(|_| NavigationMessage::IncreaseCanvasZoom { center_on_mouse: false }.into()), ..IconButton::default() })), WidgetHolder::new(Widget::IconButton(IconButton { size: 24, icon: "ZoomOut".into(), tooltip: "Zoom Out".into(), - tooltip_shortcut: action_keys!(MovementMessageDiscriminant::DecreaseCanvasZoom), - on_update: WidgetCallback::new(|_| MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }.into()), + tooltip_shortcut: action_keys!(NavigationMessageDiscriminant::DecreaseCanvasZoom), + on_update: WidgetCallback::new(|_| NavigationMessage::DecreaseCanvasZoom { center_on_mouse: false }.into()), ..IconButton::default() })), WidgetHolder::new(Widget::IconButton(IconButton { @@ -1375,7 +1375,7 @@ impl DocumentMessageHandler { icon: "ZoomReset".into(), tooltip: "Zoom to 100%".into(), tooltip_shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo100Percent), - on_update: WidgetCallback::new(|_| MovementMessage::SetCanvasZoom { zoom_factor: 1. }.into()), + on_update: WidgetCallback::new(|_| NavigationMessage::SetCanvasZoom { zoom_factor: 1. }.into()), ..IconButton::default() })), WidgetHolder::new(Widget::Separator(Separator { @@ -1384,22 +1384,22 @@ impl DocumentMessageHandler { })), WidgetHolder::new(Widget::NumberInput(NumberInput { unit: "%".into(), - value: Some(self.movement_handler.snapped_scale() * 100.), + value: Some(self.navigation_handler.snapped_scale() * 100.), min: Some(0.000001), max: Some(1000000.), on_update: WidgetCallback::new(|number_input: &NumberInput| { - MovementMessage::SetCanvasZoom { + NavigationMessage::SetCanvasZoom { zoom_factor: number_input.value.unwrap() / 100., } .into() }), increment_behavior: NumberInputIncrementBehavior::Callback, - increment_callback_decrease: WidgetCallback::new(|_| MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }.into()), - increment_callback_increase: WidgetCallback::new(|_| MovementMessage::IncreaseCanvasZoom { center_on_mouse: false }.into()), + increment_callback_decrease: WidgetCallback::new(|_| NavigationMessage::DecreaseCanvasZoom { center_on_mouse: false }.into()), + increment_callback_increase: WidgetCallback::new(|_| NavigationMessage::IncreaseCanvasZoom { center_on_mouse: false }.into()), ..NumberInput::default() })), ]; - let rotation_value = self.movement_handler.snapped_angle() / (std::f64::consts::PI / 180.); + let rotation_value = self.navigation_handler.snapped_angle() / (std::f64::consts::PI / 180.); if rotation_value.abs() > 0.00001 { widgets.extend([ WidgetHolder::new(Widget::Separator(Separator { @@ -1411,7 +1411,7 @@ impl DocumentMessageHandler { value: Some(rotation_value), increment_factor: 15., on_update: WidgetCallback::new(|number_input: &NumberInput| { - MovementMessage::SetCanvasRotation { + NavigationMessage::SetCanvasRotation { angle_radians: number_input.value.unwrap() * (std::f64::consts::PI / 180.), } .into() diff --git a/editor/src/messages/portfolio/document/mod.rs b/editor/src/messages/portfolio/document/mod.rs index 867c4f69..105e9138 100644 --- a/editor/src/messages/portfolio/document/mod.rs +++ b/editor/src/messages/portfolio/document/mod.rs @@ -2,7 +2,7 @@ mod document_message; mod document_message_handler; pub mod artboard; -pub mod movement; +pub mod navigation; pub mod overlays; pub mod properties_panel; pub mod transform_layer; diff --git a/editor/src/messages/portfolio/document/movement/mod.rs b/editor/src/messages/portfolio/document/movement/mod.rs deleted file mode 100644 index 9dd00aba..00000000 --- a/editor/src/messages/portfolio/document/movement/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -mod movement_message; -mod movement_message_handler; - -#[doc(inline)] -pub use movement_message::{MovementMessage, MovementMessageDiscriminant}; -#[doc(inline)] -pub use movement_message_handler::MovementMessageHandler; diff --git a/editor/src/messages/portfolio/document/navigation/mod.rs b/editor/src/messages/portfolio/document/navigation/mod.rs new file mode 100644 index 00000000..cd9563ea --- /dev/null +++ b/editor/src/messages/portfolio/document/navigation/mod.rs @@ -0,0 +1,7 @@ +mod navigation_message; +mod navigation_message_handler; + +#[doc(inline)] +pub use navigation_message::{NavigationMessage, NavigationMessageDiscriminant}; +#[doc(inline)] +pub use navigation_message_handler::NavigationMessageHandler; diff --git a/editor/src/messages/portfolio/document/movement/movement_message.rs b/editor/src/messages/portfolio/document/navigation/navigation_message.rs similarity index 91% rename from editor/src/messages/portfolio/document/movement/movement_message.rs rename to editor/src/messages/portfolio/document/navigation/navigation_message.rs index 332dcd46..aa869b25 100644 --- a/editor/src/messages/portfolio/document/movement/movement_message.rs +++ b/editor/src/messages/portfolio/document/navigation/navigation_message.rs @@ -5,9 +5,9 @@ use glam::DVec2; use serde::{Deserialize, Serialize}; #[remain::sorted] -#[impl_message(Message, DocumentMessage, Movement)] +#[impl_message(Message, DocumentMessage, Navigation)] #[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] -pub enum MovementMessage { +pub enum NavigationMessage { // Messages DecreaseCanvasZoom { center_on_mouse: bool, diff --git a/editor/src/messages/portfolio/document/movement/movement_message_handler.rs b/editor/src/messages/portfolio/document/navigation/navigation_message_handler.rs similarity index 95% rename from editor/src/messages/portfolio/document/movement/movement_message_handler.rs rename to editor/src/messages/portfolio/document/navigation/navigation_message_handler.rs index bae7c704..5afedb26 100644 --- a/editor/src/messages/portfolio/document/movement/movement_message_handler.rs +++ b/editor/src/messages/portfolio/document/navigation/navigation_message_handler.rs @@ -12,7 +12,7 @@ use glam::{DAffine2, DVec2}; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -pub struct MovementMessageHandler { +pub struct NavigationMessageHandler { pub pan: DVec2, panning: bool, snap_tilt: bool, @@ -28,7 +28,7 @@ pub struct MovementMessageHandler { mouse_position: ViewportPosition, } -impl Default for MovementMessageHandler { +impl Default for NavigationMessageHandler { fn default() -> Self { Self { pan: DVec2::ZERO, @@ -48,10 +48,10 @@ impl Default for MovementMessageHandler { } } -impl MessageHandler for MovementMessageHandler { +impl MessageHandler for NavigationMessageHandler { #[remain::check] - fn process_message(&mut self, message: MovementMessage, data: (&Document, &InputPreprocessorMessageHandler), responses: &mut VecDeque) { - use MovementMessage::*; + fn process_message(&mut self, message: NavigationMessage, data: (&Document, &InputPreprocessorMessageHandler), responses: &mut VecDeque) { + use NavigationMessage::*; let (document, ipp) = data; @@ -263,7 +263,7 @@ impl MessageHandler ActionList { - let mut common = actions!(MovementMessageDiscriminant; + let mut common = actions!(NavigationMessageDiscriminant; TranslateCanvasBegin, RotateCanvasBegin, ZoomCanvasBegin, @@ -277,7 +277,7 @@ impl MessageHandler f64 { let increment_radians: f64 = VIEWPORT_ROTATE_SNAP_INTERVAL.to_radians(); if self.snap_tilt { @@ -346,6 +346,6 @@ impl MovementMessageHandler { let mouse_fraction = mouse / viewport_bounds; let delta = delta_size * (DVec2::splat(0.5) - mouse_fraction); - MovementMessage::TranslateCanvas { delta }.into() + NavigationMessage::TranslateCanvas { delta }.into() } } diff --git a/editor/src/messages/portfolio/portfolio_message_handler.rs b/editor/src/messages/portfolio/portfolio_message_handler.rs index 71c3198b..a3473655 100644 --- a/editor/src/messages/portfolio/portfolio_message_handler.rs +++ b/editor/src/messages/portfolio/portfolio_message_handler.rs @@ -206,7 +206,7 @@ impl MessageHandler for Port let document_id = generate_uuid(); if self.active_document().is_some() { responses.push_back(BroadcastEvent::ToolAbort.into()); - responses.push_back(MovementMessage::TranslateCanvas { delta: (0., 0.).into() }.into()); + responses.push_back(NavigationMessage::TranslateCanvas { delta: (0., 0.).into() }.into()); } self.load_document(new_document, document_id, responses); @@ -393,7 +393,7 @@ impl MessageHandler for Port responses.push_back(BroadcastEvent::SelectionChanged.into()); responses.push_back(BroadcastEvent::DocumentIsDirty.into()); responses.push_back(PortfolioMessage::UpdateDocumentWidgets.into()); - responses.push_back(MovementMessage::TranslateCanvas { delta: (0., 0.).into() }.into()); + responses.push_back(NavigationMessage::TranslateCanvas { delta: (0., 0.).into() }.into()); } SetActiveDocument { document_id } => self.active_document_id = Some(document_id), SetPlatform { platform } => self.platform = platform, @@ -506,7 +506,7 @@ impl PortfolioMessageHandler { responses.push_back(PortfolioMessage::UpdateDocumentWidgets.into()); responses.push_back(ToolMessage::InitTools.into()); responses.push_back(PropertiesPanelMessage::Init.into()); - responses.push_back(MovementMessage::TranslateCanvas { delta: (0., 0.).into() }.into()); + responses.push_back(NavigationMessage::TranslateCanvas { delta: (0., 0.).into() }.into()); responses.push_back(DocumentMessage::DocumentStructureChanged.into()) } diff --git a/editor/src/messages/prelude.rs b/editor/src/messages/prelude.rs index 99aa89de..0ffa165d 100644 --- a/editor/src/messages/prelude.rs +++ b/editor/src/messages/prelude.rs @@ -12,7 +12,7 @@ pub use crate::messages::input_mapper::{InputMapperMessage, InputMapperMessageDi pub use crate::messages::input_preprocessor::{InputPreprocessorMessage, InputPreprocessorMessageDiscriminant, InputPreprocessorMessageHandler}; pub use crate::messages::layout::{LayoutMessage, LayoutMessageDiscriminant, LayoutMessageHandler}; pub use crate::messages::portfolio::document::artboard::{ArtboardMessage, ArtboardMessageDiscriminant, ArtboardMessageHandler}; -pub use crate::messages::portfolio::document::movement::{MovementMessage, MovementMessageDiscriminant, MovementMessageHandler}; +pub use crate::messages::portfolio::document::navigation::{NavigationMessage, NavigationMessageDiscriminant, NavigationMessageHandler}; pub use crate::messages::portfolio::document::overlays::{OverlaysMessage, OverlaysMessageDiscriminant, OverlaysMessageHandler}; pub use crate::messages::portfolio::document::properties_panel::{PropertiesPanelMessage, PropertiesPanelMessageDiscriminant, PropertiesPanelMessageHandler}; pub use crate::messages::portfolio::document::transform_layer::{TransformLayerMessage, TransformLayerMessageDiscriminant, TransformLayerMessageHandler}; diff --git a/editor/src/messages/tool/tool_messages/navigate_tool.rs b/editor/src/messages/tool/tool_messages/navigate_tool.rs index 4421e6bb..3ace685e 100644 --- a/editor/src/messages/tool/tool_messages/navigate_tool.rs +++ b/editor/src/messages/tool/tool_messages/navigate_tool.rs @@ -135,14 +135,14 @@ impl Fsm for NavigateToolFsmState { match navigate { ClickZoom { zoom_in } => { - messages.push_front(MovementMessage::TransformCanvasEnd.into()); + messages.push_front(NavigationMessage::TransformCanvasEnd.into()); // Mouse has not moved from pointerdown to pointerup if tool_data.drag_start == input.mouse.position { messages.push_front(if zoom_in { - MovementMessage::IncreaseCanvasZoom { center_on_mouse: true }.into() + NavigationMessage::IncreaseCanvasZoom { center_on_mouse: true }.into() } else { - MovementMessage::DecreaseCanvasZoom { center_on_mouse: true }.into() + NavigationMessage::DecreaseCanvasZoom { center_on_mouse: true }.into() }); } @@ -150,7 +150,7 @@ impl Fsm for NavigateToolFsmState { } PointerMove { snap_angle, snap_zoom } => { messages.push_front( - MovementMessage::PointerMove { + NavigationMessage::PointerMove { snap_angle, wait_for_snap_angle_release: false, snap_zoom, @@ -162,25 +162,25 @@ impl Fsm for NavigateToolFsmState { } TranslateCanvasBegin => { tool_data.drag_start = input.mouse.position; - messages.push_front(MovementMessage::TranslateCanvasBegin.into()); + messages.push_front(NavigationMessage::TranslateCanvasBegin.into()); NavigateToolFsmState::Panning } RotateCanvasBegin => { tool_data.drag_start = input.mouse.position; - messages.push_front(MovementMessage::RotateCanvasBegin.into()); + messages.push_front(NavigationMessage::RotateCanvasBegin.into()); NavigateToolFsmState::Tilting } ZoomCanvasBegin => { tool_data.drag_start = input.mouse.position; - messages.push_front(MovementMessage::ZoomCanvasBegin.into()); + messages.push_front(NavigationMessage::ZoomCanvasBegin.into()); NavigateToolFsmState::Zooming } TransformCanvasEnd => { - messages.push_front(MovementMessage::TransformCanvasEnd.into()); + messages.push_front(NavigationMessage::TransformCanvasEnd.into()); NavigateToolFsmState::Ready } Abort => { - messages.push_front(MovementMessage::TransformCanvasEnd.into()); + messages.push_front(NavigationMessage::TransformCanvasEnd.into()); NavigateToolFsmState::Ready } } diff --git a/frontend/wasm/src/editor_api.rs b/frontend/wasm/src/editor_api.rs index 8f475f47..2b7aaeb4 100644 --- a/frontend/wasm/src/editor_api.rs +++ b/frontend/wasm/src/editor_api.rs @@ -380,13 +380,13 @@ impl JsEditorHandle { /// Translates document (in viewport coords) pub fn translate_canvas(&self, delta_x: f64, delta_y: f64) { - let message = MovementMessage::TranslateCanvas { delta: (delta_x, delta_y).into() }; + let message = NavigationMessage::TranslateCanvas { delta: (delta_x, delta_y).into() }; self.dispatch(message); } /// Translates document (in viewport coords) pub fn translate_canvas_by_fraction(&self, delta_x: f64, delta_y: f64) { - let message = MovementMessage::TranslateCanvasByViewportFraction { delta: (delta_x, delta_y).into() }; + let message = NavigationMessage::TranslateCanvasByViewportFraction { delta: (delta_x, delta_y).into() }; self.dispatch(message); }