Announcement

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

  • NeilAgg
    replied
    Originally posted by Isomorphic View Post
    You should be able to fix it by just getting rid of the custom script block in your test.html file.
    Ahh. Got it. I was following a guide on the Internet and that is what it had.
    The lines disappear now. Thank for your help!

    Leave a comment:


  • NeilAgg
    replied
    Originally posted by Isomorphic View Post
    Did you add the line of code that calls a method called "render()"
    I had a render call in my html. I removed it.
    Attached Files

    Leave a comment:


  • Isomorphic
    replied
    Actually, it's become clear what's happening - there are two drawPanes being created in the same place, because you've added a custom <script> block in your test.html file that creates a new ZIndexTest, but that file already loads your compiled project, which also creates and draws a DrawPane. The DrawPane in front is getting the click events, and it's lines are being hidden - but the ones in the DrawPane behind are showing through.

    You should be able to fix it by just getting rid of the custom script block in your test.html file.

    Leave a comment:


  • Isomorphic
    replied
    Did you add the line of code that calls a method called "render()" and fails in the browser? If so, try getting rid of the call to render(). In SGWT, you just call draw(), and your test code was already doing that. That should fix the browser error and might fix the other issues.

    Leave a comment:


  • NeilAgg
    replied
    Originally posted by Isomorphic View Post
    you can confirm that this is working in general like this
    Using Chrome, the line disappeared so it is not my browser.

    Do I have my html and gwt.xml files correct? I am attaching them.
    I can't imagine it is the server, that is just normal Tomcat with an Apache proxy.
    Attached Files

    Leave a comment:


  • Isomorphic
    replied
    For clarity, you can confirm that this is working in general like this:

    1) go to https://smartclient.com/smartgwtee/s...e/#diagramming
    2) note the first vertical line under "Patient Arrives"
    2) in the browser console, run DrawLine3.erase() to see that line cleared

    Leave a comment:


  • NeilAgg
    replied
    I changed the build to use smartgwt-lgpl 13.1-p20241207, cleared my cache and rebooted the server. The lines still don't disappear.

    I see the render is not a function error in my console as well, I am not sure what that means. I will do some research.

    Leave a comment:


  • Isomorphic
    replied
    We see the lines stay in place at your page, with some attempt at zindex change on the first click. There's an error in the browser as well: "Uncaught TypeError: (intermediate value).render is not a function".

    Leave a comment:


  • NeilAgg
    replied
    I just tried it using Microsoft EdgeVersion 131.0.2903.112 (Official build) (64-bit) and I still see the lines after I click on them.

    Leave a comment:


  • NeilAgg
    replied
    If you try it on my dev server https://dev.3dmathpuzzles.com/ZIndexTest/test.html
    Do the lines disappear when you click them?

    Leave a comment:


  • NeilAgg
    replied
    Originally posted by Isomorphic View Post
    Testing your latest code exactly as-is, it works fine
    Wow, this is not good. I uploaded a new war file to my server and rebooted it.
    Next, I deleted the browser cache.

    I still see the lines after I click them.

    I am on Chrome Version 131.0.6778.205 (Official Build) (64-bit)
    Windows 11 Home 24H2
    smartgwt-lgpl 13.1-p20241221

    Leave a comment:


  • Isomorphic
    replied
    Testing your latest code exactly as-is, it works fine - the lines are indeed cleared when you click them.

    1) Perhaps you've got some kind of caching issue or the server needs a restart?

    2) if not, let us know your browser and OS details

    3) and your exact SmartGWT version, of course - we tested with the latest 13.1

    Leave a comment:


  • NeilAgg
    replied
    Originally posted by Isomorphic View Post
    line.erase() is working fine
    I cleaned up my code and removed the call to add the drawPane to the line. It is still not erasing.
    I am attaching the updated test case.
    Attached Files

    Leave a comment:


  • Isomorphic
    replied

    A couple of things here:

    1) line.erase() is working fine - your code is calling line.setDrawPane() after that, which is redrawing it - you only need that call at create time, or if you move the line to another DrawPane

    2) tweaking your code like this below shows sendToBack and bringToFront doing what you need

    Code:
    private static DrawPane drawPane;
    
      public static void setLineZindex(DrawLine drawLine) {
        SC.logWarn("" + drawLine.getLineColor());
        if( "#ff0000".equals(drawLine.getLineColor()) ) {
          //drawLine.setZIndex(1);
          drawLine.sendToBack();
        } else if( "#00ff00".equals(drawLine.getLineColor()) ) {
          //drawLine.setZIndex(2);
        } else if( "#0000ff".equals(drawLine.getLineColor()) ) {
          //drawLine.setZIndex(3);
          drawLine.bringToFront();
        }
    
        // don't do this, it will redraw the line if it's been cleared and is unneccesary after init
        //drawLine.setDrawPane(drawPane);
      }
    
      class MyClickHandler implements ClickHandler {
        public void onClick(ClickEvent event) {
          DrawLine drawLine = (DrawLine)event.getSource();
          SC.logWarn("Calling erase on "+drawLine);
    
          // not necessary
          //drawLine.erase();
    
          if( "#ff0000".equals(drawLine.getLineColor()) )
            drawLine.setLineColor("#00ff00");
          else if( "#00ff00".equals(drawLine.getLineColor()) )
            drawLine.setLineColor("#0000ff");
          else if( "#0000ff".equals(drawLine.getLineColor()) )
            drawLine.setLineColor("#ff0000");
    
          setLineZindex(drawLine);
    
          // not necessary
          //drawPane.markForRedraw();
        }
      }
    
      public void onModuleLoad() {
        drawPane = new DrawPane();
        drawPane.addDrawHandler(new DrawHandler() {
          public void onDraw(DrawEvent event) {
            DrawLine drawLine = new DrawLine();
            drawLine.addClickHandler(new MyClickHandler());
            drawLine.setStartPoint(new Point(250,0));
            drawLine.setEndPoint(new Point(250,500));
            drawLine.setLineColor("#ff0000");
            drawLine.setLineWidth(20);
            setLineZindex(drawLine);
    
            // this is equivalent to setDrawPane() and draw()
            drawPane.addDrawItem(drawLine, true);
    
            drawLine = new DrawLine();
            drawLine.addClickHandler(new MyClickHandler());
            drawLine.setStartPoint(new Point(0,250));
            drawLine.setEndPoint(new Point(500,250));
            drawLine.setLineColor("#00ff00");
            drawLine.setLineWidth(20);
            setLineZindex(drawLine);
            drawPane.addDrawItem(drawLine, true);
    
            DrawLine drawLine3 = new DrawLine();
            drawLine3.addClickHandler(new MyClickHandler());
            drawLine3.setStartPoint(new Point(50,50));
            drawLine3.setEndPoint(new Point(450,350));
            drawLine3.setLineColor("#0000ff");
            drawLine3.setLineWidth(20);
            setLineZindex(drawLine3);
            drawPane.addDrawItem(drawLine3, true);
          }
        });
        drawPane.setCanDragScroll(true);
        drawPane.setEdgeSize(5);
        drawPane.setEdgeOpacity(25);
        drawPane.setShowEdges(true);
        drawPane.setZoomLevel(1.0);
        drawPane.setWidth(1200);
        drawPane.setHeight(750);
        drawPane.draw();
      }
    Last edited by Isomorphic; 29 Dec 2024, 12:14.

    Leave a comment:


  • NeilAgg
    replied
    Originally posted by Isomorphic View Post
    If what you want is to bring each line to the front as you draw it, use line.bringToFront().
    Unfortunately, I have multiple layers in my application. There are other layers which need to remain in front of the line.
    I guess I can call subsequently bringToFront on all elements which are supposed layer on top. That is a workaround, but
    the clear() function is still not working as desired.

    Leave a comment:

Working...
X