fix: image editor 비율 적용

main
Jonguk. Lim 2 years ago
parent e20d02e9cd
commit db335b2057

@ -204,9 +204,11 @@
let popTitle; let popTitle;
let popOption; let popOption;
switch (flag) { switch (flag) {
// FIXME: 이미지에디터 팝업 width, height는 952, 800으로 fix
// paintweb config의 imageWidth, imageHeight, viewportWidth, viewPortHeight 와 같이 연관
case "imageEditor": case "imageEditor":
url = '<c:url value="/framework/biz/cmm/file/cmmPaintwebImageEditorPopup.do"/>'; url = '<c:url value="/framework/biz/cmm/file/cmmPaintwebImageEditorPopup.do"/>';
popOption = {width: 950, height: 750, resizable:false,scrollbars:'no'}; popOption = {width: 952, height: 800, resizable:false,scrollbars:'no'};
popTitle = "이미지 에디터"; popTitle = "이미지 에디터";
break; break;
case "imageView": case "imageView":

@ -282,9 +282,11 @@
let popTitle; let popTitle;
let popOption; let popOption;
switch (flag) { switch (flag) {
//FIXME: 이미지에디터 팝업 width, height는 952, 800으로 fix
// paintweb config의 imageWidth, imageHeight, viewportWidth, viewPortHeight 와 같이 연관
case "imageEditor": case "imageEditor":
url = '<c:url value="/framework/biz/cmm/file/cmmPaintwebImageEditorPopup.do"/>'; url = '<c:url value="/framework/biz/cmm/file/cmmPaintwebImageEditorPopup.do"/>';
popOption = {width: 950, height: 750, resizable:false,scrollbars:'no'}; popOption = {width: 952, height: 800, resizable:false,scrollbars:'no'};
popTitle = "이미지 에디터"; popTitle = "이미지 에디터";
break; break;
case "imageView": case "imageView":

@ -779,8 +779,17 @@ pwlib.gui = function (app) {
return true; // allow layouts without the zoom input return true; // allow layouts without the zoom input
} }
input.value = 100; //---------------------------------------------------------------------------------------
// FIXME : image size 조정값 zoom에 set
//---------------------------------------------------------------------------------------
console.log('initImageZoom>>>>>', app.image.width, app.image.height, app.image.zoom);
input.value = app.image.zoom * 100;
input._old_value = 100; input._old_value = 100;
//---------------------------------------------------------------------------------------
//input.value = 100;
//input._old_value = 100;
// Override the attributes, based on the settings. // Override the attributes, based on the settings.
input.setAttribute('step', config.imageZoomStep * 100); input.setAttribute('step', config.imageZoomStep * 100);
@ -795,7 +804,6 @@ pwlib.gui = function (app) {
input.addEventListener('input', changeFn, false); input.addEventListener('input', changeFn, false);
// Update some language strings // Update some language strings
var label = input.parentNode; var label = input.parentNode;
if (label.tagName.toLowerCase() === 'label') { if (label.tagName.toLowerCase() === 'label') {
label.replaceChild(doc.createTextNode(lang.imageZoomLabel), label.replaceChild(doc.createTextNode(lang.imageZoomLabel),

@ -67,8 +67,9 @@
* *
* @type String * @type String
* @default "400px" * @default "400px"
* 672px
*/ */
"viewportHeight": "620px", "viewportHeight": "82%",
/** /**
* Image save quality for the JPEG format. * Image save quality for the JPEG format.
@ -83,8 +84,9 @@
* *
* @type Number * @type Number
* @default 400 * @default 400
* 945
*/ */
"imageWidth": 800, "imageWidth": 945,
/** /**
* The default image width. * The default image width.
@ -92,7 +94,7 @@
* @type Number * @type Number
* @default 300 * @default 300
*/ */
"imageHeight": 750, "imageHeight": 800,
/** /**
* Image preload. The image you want to display when PaintWeb loads. This must * Image preload. The image you want to display when PaintWeb loads. This must
@ -176,7 +178,7 @@
* @default 0.05 * @default 0.05
*/ */
// 0.1 means 10% zoom. it's modified with zoom step in layout.xhtml. // 0.1 means 10% zoom. it's modified with zoom step in layout.xhtml.
"imageZoomStep": 0.1, "imageZoomStep": 0.01,
/** /**
* The maximum allowed image zoom level. * The maximum allowed image zoom level.

@ -948,28 +948,44 @@ function PaintWeb (win, doc) {
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// FIXME : image size 조정 - start // FIXME : image size scale 조정 - start
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
let scaleRate = 1.0; let scaleRate = 1.0;
let imgWidth = parseInt(imageLoad.width); let imgWidth = parseInt(imageLoad.width);
let imgHeight = parseInt(imageLoad.height); let imgHeight = parseInt(imageLoad.height);
const cfgImgWidth = cfg.imageWidth;
const cfgImgHeight = cfg.imageHeight;
const calWidth = imgWidth - cfgImgWidth;
const calHeight = imgHeight -cfgImgHeight;
if(imgWidth > width) {
scaleRate = width / imgWidth; if(calWidth > calHeight) {
if (imgWidth > cfgImgWidth) {
scaleRate = cfgImgWidth / imgWidth;
imgHeight = Math.floor(imgHeight * scaleRate); imgHeight = Math.floor(imgHeight * scaleRate);
} }
// viewportHeight": "620px" 설정에 맞게 set // viewportHeight": "620px" 설정에 맞게 set
if(imgHeight > 620){ if (imgHeight > cfgImgHeight) {
scaleRate = scaleRate * (620 / imgHeight); scaleRate = scaleRate * (cfgImgHeight / imgHeight);
}
}else{
if (imgHeight > cfgImgHeight) {
scaleRate = cfgImgHeight / imgHeight;
imgWidth = Math.floor(imgWidth * scaleRate);
}
// viewportHeight": "620px" 설정에 맞게 set
if (imgWidth > cfgImgWidth) {
scaleRate = scaleRate * (cfgImgWidth / imgWidth);
}
} }
this.image.zoom = MathRound(scaleRate * 10) / 10; scaleRate = scaleRate.toFixed(2);
//this.imageZoomTo(0.1); console.log('>>>>>>>>initCanvas', imageLoad.width*scaleRate, imageLoad.height*scaleRate, scaleRate)
//pwlib.inputs.imageZoom.value = 40; this.image.zoom = scaleRate;
//pwlib.initImageZoom(); //this.imageZoomTo(scaleRate)
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
// FIXME : image size 조정 - end // FIXME : image size scale 조정 - end
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------

Loading…
Cancel
Save