We're running into a problem trying to use GWT sprites for different-sized buttons, using the same background image, like so:
@Source("background.png")
@ImageOptions(width=200,height=50)
ImageResource wideButton();
@Source("background.png")
@ImageOptions(width=100,height=50)
ImageResource narrowButton();
In the css we use the image resource like so:
@sprite .wideButton {
gwt-image: "wideButton"; }
@sprite .wideButton {
gwt-image: "narrowButton"; }
This produces DIV elements with the proper dimension, but it does not display the image properly when these dimensions are smaller than the image's original width and height: the picture is cropped to fit, rather than scaled. Setting the width and height in the css does not solve the display problem.
@sprite .wideButton {
gwt-image: "narrowButton";
width: 100px;
height: 50px;
}
Is there a way to make this work, or were sprites simply not designed to be used in this way? Thanks in advance.