Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v5 #767

Merged
merged 5 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# [5.0.0-beta.1](https://github.com/szimek/signature_pad/compare/v4.2.0...v5.0.0-beta.1) (2024-04-05)


### Bug Fixes

* allow drawing outside canvas for a smoother signature ([#765](https://github.com/szimek/signature_pad/issues/765)) ([29a8b5a](https://github.com/szimek/signature_pad/commit/29a8b5a2a19387782c3eec1055389011eb7f9699))


### BREAKING CHANGES

* Drawing outside of the canvas will record data outside the canvas
* Update SignatureEvent to store the original event, x, y, pressure
* move and up events are attached once down is triggered and they are on the window/ownerDocument target

#### v4:

![sig1](https://user-images.githubusercontent.com/97994/221343969-1d8b0353-1e03-4205-9904-9587974cf11e.gif)

#### v5

![sig2](https://github.com/szimek/signature_pad/assets/97994/b9f1cfc2-aef5-4320-b97c-9fbb5cfe98ed)

# [4.2.0](https://github.com/szimek/signature_pad/compare/v4.1.7...v4.2.0) (2024-03-10)


Expand Down
5 changes: 5 additions & 0 deletions docs/css/signature-pad.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ body {
-ms-flex: 1;
flex: 1;
border: 1px solid #f4f4f4;
border-radius: 4px;
}

.signature-pad--body.empty {
background-color: #333;
}

.signature-pad--body canvas {
Expand Down
6 changes: 5 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</span>

<div id="signature-pad" class="signature-pad">
<div class="signature-pad--body">
<div id="canvas-wrapper" class="signature-pad--body">
<canvas></canvas>
</div>
<div class="signature-pad--footer">
Expand All @@ -59,6 +59,10 @@
background</button>
</div>
</div>

<div>
<button type="button" class="button" data-action="open-in-window">Open in Window</button>
</div>
</div>
</div>

Expand Down
19 changes: 19 additions & 0 deletions docs/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const wrapper = document.getElementById("signature-pad");
const canvasWrapper = document.getElementById("canvas-wrapper");
const clearButton = wrapper.querySelector("[data-action=clear]");
const changeBackgroundColorButton = wrapper.querySelector("[data-action=change-background-color]");
const changeColorButton = wrapper.querySelector("[data-action=change-color]");
Expand All @@ -9,6 +10,7 @@ const savePNGButton = wrapper.querySelector("[data-action=save-png]");
const saveJPGButton = wrapper.querySelector("[data-action=save-jpg]");
const saveSVGButton = wrapper.querySelector("[data-action=save-svg]");
const saveSVGWithBackgroundButton = wrapper.querySelector("[data-action=save-svg-with-background]");
const openInWindowButton = wrapper.querySelector("[data-action=open-in-window]");
let undoData = [];
const canvas = wrapper.querySelector("canvas");
const signaturePad = new SignaturePad(canvas, {
Expand Down Expand Up @@ -182,3 +184,20 @@ saveSVGWithBackgroundButton.addEventListener("click", () => {
download(dataURL, "signature.svg");
}
});

openInWindowButton.addEventListener("click", () => {
var externalWin = window.open('', '', `width=${canvas.width / window.devicePixelRatio},height=${canvas.height / window.devicePixelRatio}`);
canvas.style.width = "100%";
canvas.style.height = "100%";
externalWin.onresize = resizeCanvas;
externalWin.document.body.style.margin = '0';
externalWin.document.body.appendChild(canvas);
canvasWrapper.classList.add("empty");
externalWin.onbeforeunload = () => {
canvas.style.width = "";
canvas.style.height = "";
canvasWrapper.classList.remove("empty");
canvasWrapper.appendChild(canvas);
resizeCanvas();
};
})
4 changes: 2 additions & 2 deletions docs/js/signature_pad.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/js/signature_pad.umd.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "signature_pad",
"description": "Library for drawing smooth signatures.",
"version": "4.2.0",
"version": "5.0.0-beta.1",
"homepage": "https://github.com/szimek/signature_pad",
"author": {
"name": "Szymon Nowak",
Expand Down
Loading
Loading