2021年1月27日星期三

After adding a drop shadow to a list cell hovering and selection events are bugged

So I added the below fx-css to a list-cell.

.list-cell:selected:filled:hover {      -fx-view-order: -1;      -fx-effect: dropshadow(gaussian, #67676D, 12, 0.05, 0.0, 2);  }  

Note when a list-cell is :selected its background is grey.

Now it seems the node boundaries are extended to the end of the drop shadow over the surrounding cells. This behavior is unwanted as the cell with the shadow captures events that should really be handled by the below or above cell.

enter image description here

Is there a fix for this?

Note: the same fx-css can be applied to a table-view and this unwanted functionally does not occur.

public class ListViewTest {      @Test      public void testFx() throws InterruptedException {          new JFXPanel();          CountDownLatch latch = new CountDownLatch(1);          Platform.runLater(() -> {              ListView<String> lv =  new ListView<>();              Stage stage = new Stage();              Scene scene = new Scene(lv);              stage.setScene(scene);              stage.show();              scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());          });          latch.await();      }  }  
https://stackoverflow.com/questions/65929630/after-adding-a-drop-shadow-to-a-list-cell-hovering-and-selection-events-are-bugg January 28, 2021 at 09:07AM

没有评论:

发表评论