IDEMPIERE-4196 Image Field: Not fully clickable on user window and doesn't maintain aspect ratio
This commit is contained in:
parent
2d06047049
commit
dfcb22fa5c
|
@ -25,9 +25,12 @@ import org.compiere.model.MImage;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.zkoss.image.AImage;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Cell;
|
||||
import org.zkoss.zul.Image;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +56,21 @@ public class WImageEditor extends WEditor
|
|||
|
||||
public WImageEditor(GridField gridField)
|
||||
{
|
||||
super(new Image(), gridField);
|
||||
super(new Image() {
|
||||
private static final long serialVersionUID = 8492629361709791256L;
|
||||
|
||||
@Override
|
||||
public void onPageAttached(Page newpage, Page oldpage) {
|
||||
super.onPageAttached(newpage, oldpage);
|
||||
if (newpage != null && getParent() != null) {
|
||||
Component p = getParent();
|
||||
if (p instanceof Cell) {
|
||||
Cell cell = (Cell) p;
|
||||
LayoutUtils.addSclass("image-field-cell", cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, gridField);
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -66,7 +83,7 @@ public class WImageEditor extends WEditor
|
|||
{
|
||||
AImage img = null;
|
||||
getComponent().setContent(img);
|
||||
getComponent().setSclass("image-field");
|
||||
getComponent().setSclass("image-field image-fit-contain");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -205,6 +205,7 @@ public class WImageDialog extends Window implements EventListener<Event>
|
|||
ZKUpdateUtil.setHflex(image, "true");
|
||||
ZKUpdateUtil.setVflex(image, "true");
|
||||
center.setParent(mainLayout);
|
||||
image.setSclass("image-fit-contain");
|
||||
center.appendChild(image);
|
||||
|
||||
South south = new South();
|
||||
|
|
|
@ -190,6 +190,12 @@ span.grid-combobox-editor {
|
|||
cursor: default;
|
||||
border: none;
|
||||
}
|
||||
.image-fit-contain {
|
||||
object-fit: contain;
|
||||
}
|
||||
.z-cell.image-field-cell {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.html-field {
|
||||
cursor: pointer;
|
||||
|
|
Loading…
Reference in New Issue