Flyer53 / jsPanel4

A JavaScript library to create highly configurable floating panels, modals, tooltips, hints/notifiers/alerts or contextmenus for use in backend solutions and other web applications.
https://jspanel.de/
Other
313 stars 57 forks source link

Use the opacity value specified in options after repositioning the panel #206

Closed dbrnz closed 8 months ago

dbrnz commented 1 year ago

Setting a value for opacity when creating a panel results in the new panel having this opacity. However opacity is reset to 1 after the panel is repositioned.

Describe the solution you'd like To respect whatever opacity is set as an option, including while the panel is being repositioned.

Flyer53 commented 1 year ago

@dbrnz Hi David, sorry for the late answer ... Yes, there seems to be a little bug. Please give me a bit time to take care of that. I guess I'll find some time in one or two weeks. Regards, Stefan

Flyer53 commented 12 months ago

@dbrnz Hi again ... after thinking about this some more I have to say that I don't consider this as bug. Why: this option was never meant as a way to permanently set an opacity value, just to make the panel "unvisible" before it's positioned correctly or something similar. So I won't make any changes concerning this. However, you can still acieve a permanent opacity lower as 1.0, even while draging a panel, by adding some code to the panel config as shown below:

jsPanel.create({
  dragit: {
    start: panel => panel.style.opacity = 0.5,
    stop:  panel => panel.style.opacity = 0.5
  },
  callback: panel => {
    panel.style.opacity = 0.5;
    /**
        Panel opacity returns to 1.0 when the cursor leaves the browser window
        after the panel was dragged. With the following handler the panel opacity is restored to the
        desired value when the cursor comes back into the window.
    **/
    document.addEventListener("pointerout", event => panel.style.opacity = 0.5);
  }
});

It's probably not the solution you hope for, but it does the job ... although not quite perfectly. Please let me know whether you can work with this. Regards, Stefan

Flyer53 commented 8 months ago

@dbrnz Since you didn't answer to the last comment for more than 4 months I consider this topic as irrelevant now ...