mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Layer snapping
* Test snapping * Snap new shapes * Fix snapping when zoomed * Refactor to use viewport bounds * Reduce snap tolerance to 3 * Snap line and path tool * Add disable snapping and refactor * new_snap -> new status * Rearrange import * Cleanup * Fix incorrect variable name * Store snap data in tool data
This commit is contained in:
parent
26835d8d29
commit
0e33498b9b
13 changed files with 229 additions and 46 deletions
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
<div class="spacer"></div>
|
||||
<div class="right side">
|
||||
<OptionalInput v-model:checked="snappingEnabled" @update:checked="comingSoon(200)" :icon="'Snapping'" title="Snapping" />
|
||||
<OptionalInput v-model:checked="snappingEnabled" @update:checked="setSnap" :icon="'Snapping'" title="Snapping" />
|
||||
<PopoverButton>
|
||||
<h3>Snapping</h3>
|
||||
<p>The contents of this popover menu are coming soon</p>
|
||||
|
@ -263,6 +263,9 @@ const viewModeEntries: RadioEntries = [
|
|||
|
||||
export default defineComponent({
|
||||
methods: {
|
||||
async setSnap(newStatus: boolean) {
|
||||
(await wasm).set_snapping(newStatus);
|
||||
},
|
||||
async viewportResize() {
|
||||
const canvas = this.$refs.canvas as HTMLElement;
|
||||
// Get the width and height rounded up to the nearest even number because resizing is centered and dividing an odd number by 2 for centering causes antialiasing
|
||||
|
|
|
@ -326,6 +326,13 @@ pub fn export_document() {
|
|||
dispatch(message);
|
||||
}
|
||||
|
||||
/// Set snapping disabled / enabled
|
||||
#[wasm_bindgen]
|
||||
pub fn set_snapping(new_status: bool) {
|
||||
let message = DocumentMessage::SetSnapping(new_status);
|
||||
dispatch(message);
|
||||
}
|
||||
|
||||
/// Sets the zoom to the value
|
||||
#[wasm_bindgen]
|
||||
pub fn set_canvas_zoom(new_zoom: f64) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue