fix: image editor 비율 적용

main
Jonguk. Lim 2 years ago
parent e20d02e9cd
commit db335b2057

@ -204,9 +204,11 @@
let popTitle;
let popOption;
switch (flag) {
// FIXME: 이미지에디터 팝업 width, height는 952, 800으로 fix
// paintweb config의 imageWidth, imageHeight, viewportWidth, viewPortHeight 와 같이 연관
case "imageEditor":
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 = "이미지 에디터";
break;
case "imageView":

@ -282,9 +282,11 @@
let popTitle;
let popOption;
switch (flag) {
//FIXME: 이미지에디터 팝업 width, height는 952, 800으로 fix
// paintweb config의 imageWidth, imageHeight, viewportWidth, viewPortHeight 와 같이 연관
case "imageEditor":
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 = "이미지 에디터";
break;
case "imageView":

@ -779,8 +779,17 @@ pwlib.gui = function (app) {
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.value = 100;
//input._old_value = 100;
// Override the attributes, based on the settings.
input.setAttribute('step', config.imageZoomStep * 100);
@ -795,7 +804,6 @@ pwlib.gui = function (app) {
input.addEventListener('input', changeFn, false);
// Update some language strings
var label = input.parentNode;
if (label.tagName.toLowerCase() === 'label') {
label.replaceChild(doc.createTextNode(lang.imageZoomLabel),

@ -67,8 +67,9 @@
*
* @type String
* @default "400px"
* 672px
*/
"viewportHeight": "620px",
"viewportHeight": "82%",
/**
* Image save quality for the JPEG format.
@ -83,8 +84,9 @@
*
* @type Number
* @default 400
* 945
*/
"imageWidth": 800,
"imageWidth": 945,
/**
* The default image width.
@ -92,7 +94,7 @@
* @type Number
* @default 300
*/
"imageHeight": 750,
"imageHeight": 800,
/**
* Image preload. The image you want to display when PaintWeb loads. This must
@ -176,7 +178,7 @@
* @default 0.05
*/
// 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.

@ -948,28 +948,44 @@ function PaintWeb (win, doc) {
//---------------------------------------------------------------------------------------
// FIXME : image size 조정 - start
// FIXME : image size scale 조정 - start
//---------------------------------------------------------------------------------------
let scaleRate = 1.0;
let imgWidth = parseInt(imageLoad.width);
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);
}
// viewportHeight": "620px" 설정에 맞게 set
if(imgHeight > 620){
scaleRate = scaleRate * (620 / imgHeight);
if (imgHeight > cfgImgHeight) {
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;
//this.imageZoomTo(0.1);
scaleRate = scaleRate.toFixed(2);
console.log('>>>>>>>>initCanvas', imageLoad.width*scaleRate, imageLoad.height*scaleRate, scaleRate)
//pwlib.inputs.imageZoom.value = 40;
//pwlib.initImageZoom();
this.image.zoom = scaleRate;
//this.imageZoomTo(scaleRate)
//---------------------------------------------------------------------------------------
// FIXME : image size 조정 - end
// FIXME : image size scale 조정 - end
//---------------------------------------------------------------------------------------

Loading…
Cancel
Save