Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8111889

Region pick behavior is wrong




      Region behaves counter-intuitively regarding mouse event delivering. It reacts on mouse events everywhere in its bounds and people are often confused by it. Here are two simple examples:

      1) You create let's say HBox just because you want it to layout its children. The HBox catches all mouse events in the whole area given by its bounds. Often it's hard to understand what area it is (with children of different size or with some other layout stretches taking place).

      2) You create a small Pane in top-left corner of the scene with a child in bottom-right corner of the scene. Pane's bounds will then cover whole sceen and you won't be able to click on anything else than the pane and its child. Users don't understand why, because both visually and in source code there is nothing in between the pane and the child.

      Moreover, region may have a shape associated and the behavior here is also strange. If you create a region with a shape inside its bounds, it's just ignored. You can also create a shape somewhere else, then it extends region's bounds and it reacts on mouse click everywhere between the shape and the region.

      This behavior needs to be fixed.

      Region should react on mouse in its shape plus in its children. With (the default) null shape it will behave similarly to group (the children will be picked but never the region itself). This is intuitive for layout boxes. With the shape set (and it can be a transparent shape), it will react on mouse in the area of the shape if no children are picked.

      The only problem here is that region can be visible even without shape, because it has some borders and fills (I'm not an expert in this area). So we need to consider those as shape as well during picking.


          Issue Links



              psafrata Pavel Šafrata
              psafrata Pavel Šafrata
              1 Vote for this issue
              3 Start watching this issue