Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    MouseHandler not behaving as expected when leaving and re-entering Canvas

    Hi Isomorphic,

    please see this test case showing unexpected behaviour in FF26 Dev Mode (v9.1p_2014-04-09):

    Code:
    package com.smartgwt.sample.client;
    
    import com.smartgwt.client.types.Overflow;
    import com.smartgwt.client.types.VerticalAlignment;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.Img;
    import com.smartgwt.client.widgets.Label;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.events.MouseDownEvent;
    import com.smartgwt.client.widgets.events.MouseDownHandler;
    import com.smartgwt.client.widgets.events.MouseOutEvent;
    import com.smartgwt.client.widgets.events.MouseOutHandler;
    import com.smartgwt.client.widgets.events.MouseOverEvent;
    import com.smartgwt.client.widgets.events.MouseOverHandler;
    import com.smartgwt.client.widgets.events.MouseUpEvent;
    import com.smartgwt.client.widgets.events.MouseUpHandler;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class MyTest extends HLayout {
    	private static String ico = "[SKIN]/actions/accept.png";
    	// private static String ico = "[SKIN]/svgtest.svg";
    	private static String bigDesc = "headerheader";
    	private static String smallDesc = "foobar";
    
    	VLayout vL;
    	Label big;
    	Label small;
    	Img i;
    
    	public MyTest() {
    		super();
    		setPadding(1);
    		setMembersMargin(2);
    		setHeight(62);
    		setWidth(200);
    		setOverflow(Overflow.HIDDEN);
    		setBackgroundColor("white");
    		setShowShadow(true);
    		setShadowSoftness(4);
    		setShadowOffset(4);
    		setBorder("1px solid red");
    
    		i = new Img(ico, 60, 60);
    		big = new Label("<span style=\"font-size: 15px\">" + bigDesc + "</span>");
    		// big.setBackgroundColor("white");
    		big.setHeight(20);
    		big.setBorder("1px solid red");
    		small = new Label(smallDesc);
    		// small.setBackgroundColor("white");
    		small.setHeight(15);
    		small.setBorder("1px solid red");
    		vL = new VLayout(0);
    		vL.setPadding(0);
    		// vL.setWidth(40);
    		// vL.setHeight(40);
    		vL.setMembers(big, small);
    		vL.setOverflow(Overflow.HIDDEN);
    		vL.setAlign(VerticalAlignment.CENTER);
    		vL.setBorder("1px solid red");
    
    		setMembers(i, vL);
    
    		addMouseDownHandler(new MouseDownHandler() {
    			@Override
    			public void onMouseDown(MouseDownEvent event) {
    				setShadowOffset(2);
    			}
    		});
    
    		addMouseUpHandler(new MouseUpHandler() {
    			@Override
    			public void onMouseUp(MouseUpEvent event) {
    				setShadowOffset(4);
    			}
    		});
    
    		addMouseOverHandler(new MouseOverHandler() {
    			@Override
    			public void onMouseOver(MouseOverEvent event) {
    				setBackgroundColor("lightblue");
    			}
    		});
    
    		addMouseOutHandler(new MouseOutHandler() {
    			@Override
    			public void onMouseOut(MouseOutEvent event) {
    				setBackgroundColor("white");
    				setShadowOffset(4);
    			}
    		});
    
    		addClickHandler(new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				SC.say("Click!");
    			}
    		});
    	}
    }
    1st test case:
    1. Click "New"
    2. Move over the Canvas (either Img or one of the Labels) -> Background is changed to light blue
    3. Left-Click without releasing -> Shadow becomes smaller
    4. Move inside the Canvas to another member -> Background is changed to white
    5. Release left mouse button -> No click is issued
    6. (It only get blue and issues the click when over the member where you pressed the mouse button)


    2nd test case:
    1. Click "New"
    2. Move over the Canvas (either Img or one of the Labels) -> Background is changed to light blue
    3. Left-Click without releasing -> Shadow becomes smaller
    4. Move outside the Canvas -> Background is changed to white, Shadow becomes smaller
    5. Move to the same member inside the Canvas -> Background is changed to light blue, Shadow does not become smaller
    6. Release left mouse button -> Click is issued
    7. (It only gets blue and issues the click when over the member where you pressed the mouse button)


    Expected behaviour:
    1. Click "New"
    2. Move over the Canvas (either Img or one of the Labels) -> Background is changed to light blue
    3. Left-Click without releasing -> Shadow becomes smaller
    4. Move inside the Canvas to another member (background stays light blue)
    5. Move outside the Canvas -> Background is changed to white, shadow becomes bigger
    6. Move anywhere inside the Canvas -> Background is changed to light blue, shadow becomes smaller
    7. Release left mouse button -> Click is issued


    I realize the the last "shadow becomes smaller" might not be possible as there is no new MouseDownEvent, but the rest is a bug in my opinion.

    Best regards,
    Blama
    Last edited by Blama; 11 Apr 2014, 05:19.
Working...
X