diff --git a/app/javascript/elements/signature_form.js b/app/javascript/elements/signature_form.js index aa60b6fbd..845a6b6cf 100644 --- a/app/javascript/elements/signature_form.js +++ b/app/javascript/elements/signature_form.js @@ -5,6 +5,8 @@ export default targetable(class extends HTMLElement { static [target.static] = ['canvas', 'input', 'clear', 'button'] async connectedCallback () { + this.lockSwipe(true) + const { default: SignaturePad } = await import('signature_pad') this.setCanvasSize() @@ -61,11 +63,17 @@ export default targetable(class extends HTMLElement { } disconnectedCallback () { + this.lockSwipe(false) + if (this.resizeObserver) { this.resizeObserver.disconnect() } } + lockSwipe (locked) { + window.webkit?.messageHandlers?.native?.postMessage({ type: 'swipe', op: locked ? 'lock' : 'unlock' }) + } + setCanvasSize () { const scale = 3 diff --git a/app/views/profile/index.html.erb b/app/views/profile/index.html.erb index e3b393bc5..8bc1af296 100644 --- a/app/views/profile/index.html.erb +++ b/app/views/profile/index.html.erb @@ -40,7 +40,7 @@ <% end %> - + <%= t('update_signature') %>

@@ -53,7 +53,7 @@ <% end %> - + <%= t('update_initials') %> <% if true_user == current_user && !current_account.testing? %> diff --git a/app/views/user_initials/edit.html.erb b/app/views/user_initials/edit.html.erb index 584cc2742..14eba2f16 100644 --- a/app/views/user_initials/edit.html.erb +++ b/app/views/user_initials/edit.html.erb @@ -1,6 +1,6 @@ <%= render 'shared/turbo_modal', title: t('update_initials') do %> <% options = [[t('draw'), 'draw'], [t('upload'), 'upload']] %> - +

<% options.each_with_index do |(label, value), index| %> diff --git a/app/views/user_signatures/edit.html.erb b/app/views/user_signatures/edit.html.erb index ebfffbfde..222525e1b 100644 --- a/app/views/user_signatures/edit.html.erb +++ b/app/views/user_signatures/edit.html.erb @@ -1,6 +1,6 @@ <%= render 'shared/turbo_modal', title: t('update_signature') do %> <% options = [[t('draw'), 'draw'], [t('upload'), 'upload']] %> - +
<% options.each_with_index do |(label, value), index| %>