Skip to content

Commit a916945

Browse files
committed
build
1 parent 4c934b2 commit a916945

File tree

6 files changed

+58
-22
lines changed

6 files changed

+58
-22
lines changed

dist/vue-croppa.js

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* vue-croppa v0.2.0
2+
* vue-croppa v0.2.1
33
* https://github.com/zhanziyang/vue-croppa
44
*
55
* Copyright (c) 2017 zhanziyang
@@ -487,12 +487,44 @@ var component = { render: function render() {
487487
value: function value(val) {
488488
this.instance = val;
489489
},
490-
realWidth: 'init',
491-
realHeight: 'init',
492-
canvasColor: 'init',
493-
placeholder: 'init',
494-
placeholderColor: 'init',
495-
realPlaceholderFontSize: 'init',
490+
realWidth: function realWidth() {
491+
if (!this.img) {
492+
this.init();
493+
} else {
494+
this.setSize();
495+
this.imgContentInit();
496+
}
497+
},
498+
realHeight: function realHeight() {
499+
if (!this.img) {
500+
this.init();
501+
} else {
502+
this.setSize();
503+
this.imgContentInit();
504+
}
505+
},
506+
canvasColor: function canvasColor() {
507+
if (!this.img) {
508+
this.init();
509+
} else {
510+
this.draw();
511+
}
512+
},
513+
placeholder: function placeholder() {
514+
if (!this.img) {
515+
this.init();
516+
}
517+
},
518+
placeholderColor: function placeholderColor() {
519+
if (!this.img) {
520+
this.init();
521+
}
522+
},
523+
realPlaceholderFontSize: function realPlaceholderFontSize() {
524+
if (!this.img) {
525+
this.init();
526+
}
527+
},
496528
preventWhiteSpace: function preventWhiteSpace() {
497529
this.imgContentInit();
498530
}
@@ -503,13 +535,8 @@ var component = { render: function render() {
503535
var _this = this;
504536

505537
this.canvas = this.$refs.canvas;
506-
this.canvas.width = this.realWidth;
507-
this.canvas.height = this.realHeight;
508-
this.canvas.style.width = this.width + 'px';
509-
this.canvas.style.height = this.height + 'px';
510-
// this.$refs.wrapper.style.width = this.width + 'px'
511-
// this.$refs.wrapper.style.height = this.height + 'px'
512-
this.canvas.style.backgroundColor = !this.canvasColor || this.canvasColor == 'default' ? '#e6e6e6' : typeof this.canvasColor === 'string' ? this.canvasColor : '';
538+
this.setSize();
539+
this.canvas.style.backgroundColor = !this.canvasColor || this.canvasColor == 'default' ? 'transparent' : typeof this.canvasColor === 'string' ? this.canvasColor : '';
513540
this.ctx = this.canvas.getContext('2d');
514541
this.originalImage = null;
515542
this.img = null;
@@ -581,6 +608,14 @@ var component = { render: function render() {
581608
supportDetection: this.supportDetection
582609
});
583610
},
611+
setSize: function setSize() {
612+
this.canvas.width = this.realWidth;
613+
this.canvas.height = this.realHeight;
614+
this.canvas.style.width = this.width + 'px';
615+
this.canvas.style.height = this.height + 'px';
616+
// this.$refs.wrapper.style.width = this.width + 'px'
617+
// this.$refs.wrapper.style.height = this.height + 'px'
618+
},
584619
rotateByStep: function rotateByStep(step) {
585620
var orientation = 1;
586621
switch (step) {
@@ -1075,7 +1110,7 @@ var component = { render: function render() {
10751110
}
10761111
},
10771112
paintBackground: function paintBackground() {
1078-
var backgroundColor = !this.canvasColor || this.canvasColor == 'default' ? '#e6e6e6' : this.canvasColor;
1113+
var backgroundColor = !this.canvasColor || this.canvasColor == 'default' ? 'transparent' : this.canvasColor;
10791114
this.ctx.fillStyle = backgroundColor;
10801115
this.ctx.clearRect(0, 0, this.realWidth, this.realHeight);
10811116
this.ctx.fillRect(0, 0, this.realWidth, this.realHeight);

dist/vue-croppa.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)