Skip to content

Commit

Permalink
Available cropper uni scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
lilitsimonyan98 committed Apr 27, 2020
1 parent 14418c8 commit 282c15d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-image-markup",
"version": "3.0.14",
"version": "3.0.15",
"description": "vue-image-markup will provide you to edit uploaded image easily and save it.",
"main": "src/Editor.vue",
"repository": {
Expand Down
12 changes: 12 additions & 0 deletions src/assets/js/crop.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default (function () {
}
this.bindEvents();
this.canvas.selectable = false;
this.canvas.uniScaleTransform = true;
this.canvas.renderAll();
let inst = this;
new fabric.Image.fromURL(src, function (oImg) {
Expand Down Expand Up @@ -105,6 +106,7 @@ export default (function () {
lockUniScaling: JSON.parse(properties.lockUniScaling),
noScaleCache: JSON.parse(properties.noScaleCache),
strokeUniform: JSON.parse( properties.strokeUniform),

clipTo: function (context) {
context.translate(-this.width / 2, -this.height / 2);
for (let x = 0; x <= this.width; x += this.width / 3) {
Expand All @@ -120,6 +122,16 @@ export default (function () {
context.stroke();
}
});
rectRed.setControlsVisibility({
tl:true,
mt:false,
tr:true,
ml:false,
mr:false,
bl:true,
mb:false,
br:true
}),
clipRect = new fabric.Rect({
left: -(cropperWidth / 2),
top: -(cropperHeight / 2),
Expand Down

0 comments on commit 282c15d

Please sign in to comment.