@@ -45,9 +45,9 @@ MyCanvas.prototype.clear = function () {
45
45
this . ctx . clearRect ( 0 , 0 , this . canvas . width , this . canvas . height ) ;
46
46
} ;
47
47
48
- // 크롭할 이미지 로드하기
49
- MyCanvas . prototype . initCropImage = function ( ) {
50
- //console.log('initCropImage ', this.drawnImgSrc.substr(20, 30));
48
+ // 이미지 로드하기
49
+ MyCanvas . prototype . initImage = function ( ) {
50
+ //console.log('initImage ', this.drawnImgSrc.substr(20, 30));
51
51
this . clear ( ) ;
52
52
this . drawnImg = new Image ( ) ;
53
53
this . drawnImg . src = this . drawnImgSrc ;
@@ -169,7 +169,7 @@ MyCanvas.prototype.crop = function () {
169
169
) ;
170
170
171
171
// 새로운 이미지 생성. 기존 크롭이미지 대체
172
- this . drawnImgSrc = c . toDataURL ( ) ;
172
+ this . drawnImgSrc = c . toDataURL ( 'image/png' , 1 ) ;
173
173
this . isCropped = ! this . isCropped ;
174
174
175
175
// 이전 포인트 지우기
@@ -178,7 +178,7 @@ MyCanvas.prototype.crop = function () {
178
178
179
179
MyCanvas . prototype . makePattern = function ( props ) {
180
180
const myPattern = new MyPattern ( this . wrapper , this . canvas , this . ctx , this . drawnImgSrc ) ;
181
- myPattern . initCropImage ( ) ;
181
+ myPattern . initImage ( ) ;
182
182
183
183
// 설정값 초기화
184
184
myPattern . setColor = props . color ;
@@ -189,11 +189,12 @@ MyCanvas.prototype.makePattern = function (props) {
189
189
myPattern . setGap = props . gap ;
190
190
myPattern . setType = props . type ;
191
191
192
- myPattern . makePattern ( ) ;
192
+ // 이미지 저장 시 myCanvas.drawnImgSrc 참조하므로 getter로 src저장
193
+ this . drawnImgSrc = myPattern . getPatternSrc ;
193
194
194
195
// const my = this;
195
196
// const img = new Image();
196
- // img.src = c.toDataURL();
197
+ // img.src = c.toDataURL('image/jpeg' );
197
198
// img.onload = function () {
198
199
// // 새 이미지 페이지에 삽입하기
199
200
// my.wrapper.appendChild(this);
0 commit comments