Announcement

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

    bug with snapTo ?

    SmartClient Version: v12.1p_2021-05-04/AllModules Development Only (built 2021-05-04)

    Chrome on MacOS

    Hello, while playing with the snapTo sample in the showcase, I maybe found a bug (or am I doing something wrong?).

    Please try this test case:

    Code:
    // --------------------------------
    // Simple snap to
    var commonProps = {
    height:"30%", width: "30%",
    align: "center",
    border: "1px solid black",
    styleName: "exampleTextBlock"
    };
    
    
    // --------------------------------
    // Snap to with fixed pixel offsets
    
    isc.Canvas.create({
    ID:"offsetContainer",
    height:"100%", width:"*",
    minHeight:280, minWidth:280,
    border: "1px solid #7e7e7e",
    overflow:"hidden",
    showHover:true,
    prompt:"Snap offsets specified",
    canDragResize: true,
    children: [
    isc.Label.create({
    ID:"label1a",
    contents: "Top Left",
    backgroundColor: "#FFAAAA",
    snapTo:"TL",
    snapOffsetTop: 10,
    snapOffsetLeft: 10
    }, commonProps),
    
    isc.Label.create({
    ID:"label2a",
    contents: "Top Right",
    backgroundColor: "#BEC9FE",
    snapTo:"TR",
    snapOffsetTop:10,
    snapOffsetLeft:-10
    }, commonProps),
    
    isc.Label.create({
    ID: "label3a",
    contents: "Bottom Left",
    backgroundColor: "#D8D5D6",
    snapTo:"BL",
    snapOffsetLeft: 10,
    snapOffsetTop: -10
    }, commonProps),
    
    isc.Label.create({
    ID: "label4a",
    contents: "Left",
    backgroundColor: "#CCFFCC",
    snapTo:"L",
    snapOffsetLeft: 10
    }, commonProps),
    
    isc.Label.create({
    ID: "label5a",
    contents: "Right",
    backgroundColor: "#AB5654",
    snapTo: "R",
    snapOffsetLeft: -10
    }, commonProps),
    
    isc.Label.create({
    ID: "label6a",
    contents: "Bottom",
    backgroundColor: "#DCEFEF",
    snapTo:"B",
    snapOffsetTop: -10
    }, commonProps),
    
    isc.Label.create({
    ID: "label7a",
    contents: "Top",
    showHover: true,
    prompt: "SnapOffsetTop using percentage",
    backgroundColor: "#FFCC99",
    snapTo:"T",
    snapOffsetTop: 10
    }, commonProps),
    
    isc.Label.create({
    ID: "label8a",
    contents: "Bottom Right",
    backgroundColor: "#F8BFFB",
    snapTo:"BR",
    snapOffsetTop: -10,
    snapOffsetLeft: -10
    }, commonProps),
    
    isc.Label.create({
    ID: "label8a",
    contents: "Center",
    backgroundColor: "#F8BFFB",
    snapTo:"C",
    //snapOffsetTop: -10,
    //snapOffsetLeft: -10
    }, commonProps)
    ]
    });
    
    isc.LayoutSpacer.create({
    ID: "spacer",
    width: 100
    });
    
    isc.HLayout.create({
    ID: "controlLayout",
    membersMargin: 20,
    height:"100%",
    width:"100%",
    members: [
    offsetContainer
    ]
    });
    If you try various resize, you'll see that sometimes the bottom-right label goes out of position, as you may see:

    https://www.youtube.com/watch?v=Ws2sR_Wc2Jo
    Last edited by claudiobosticco; 4 May 2021, 06:51.

    #2
    This code doesn't seem to match the video, and also has an ID collision (two Labels with ID label8a). Long story why this would be, but correcting the ID collision fixes the seeming issue.

    Comment


      #3
      Hi, thanks a lot for the heads up and sorry for the bogus report 🤦🏻

      Comment

      Working...
      X