1
0
mirror of https://github.com/24eme/signaturepdf.git synced 2023-08-25 09:33:08 +02:00

Conserve toujours le ratio des objets

This commit is contained in:
Vincent LAURENT 2021-10-12 01:01:10 +02:00
parent 3676b874d3
commit 3a44c5a9b7

View File

@ -430,6 +430,7 @@ loadingTask.promise.then(function(pdf) {
fabric.loadSVGFromURL(item, function(objects, options) {
var svg = fabric.util.groupSVGElements(objects, options);
svg.svgOrigin = item;
svg.lockScalingFlip = true;
svg.scaleToHeight(100);
if(svg.getScaledWidth() > 200) {
svg.scaleToWidth(200);
@ -627,6 +628,14 @@ loadingTask.promise.then(function(pdf) {
input_selected.checked = false;
input_selected.dispatchEvent(new Event("change"));
});
canvasEdition.on('object:scaling', function(event) {
if(event.transform.action == "scaleX") {
event.target.scaleY = event.target.scaleX;
}
if(event.transform.action == "scaleY") {
event.target.scaleX = event.target.scaleY;
}
});
canvasEdition.on('object:scaled', function(event) {
var item = getSvgItem(event.target.svgOrigin);
if(!item) {