Topic:   how can i make an imageView and the shape circle act as the same and one object, the actions i make on the imageView i want the circle to act with it.
Apr 07, 2021 12:01 2 Replies 112 Views VAMSI

how can i make an imageView and the shape circle act as the same and one object, the actions i make on the imageView i want the circle to act with it.

the circle will be above the image, but when i move the imageView to the left or right i want the circle to move along with the imageView

i tried the BorderPane, but that only puts it in front of the image with none of the actions act the same

as for the canvas, i can't add an imageView to the canvas except with the borderPane and that is useless too.

here's an example of my action on imageView (Hscroll is a Slider):

Hscroll.valueProperty().addListener(e->{

offSetX = Hscroll.getValue();

zoomlvl = zoomLvl.getValue();

double newValue = (double)((int)(zoomlvl*10))/10;

value.setText(newValue+"");

if(offSetX<(width/newValue)/2) {

offSetX = (width/newValue)/2;

}

if(offSetX>width-((width/newValue)/2)) {

offSetX = width-((width/newValue)/2);

}

imageView.setViewport(new Rectangle2D(offSetX-((width/newValue)/2), offSetY-((height/newValue)/2), width/newValue, height/newValue));

});

Prev Next
Topic Replies (2)
  1. 1
    idnkx user

    JOSHUA

    You can try to set the coordinates of the circle when you invoke some action in the imageView.

    1
    idnkx user

    RANJIT

    . Use the TranslateX OR TranslateY property to move your imageview and circle. The circle moment can be triggered by ImageView event or a button if provided.

Leave a Reply
Guest User

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.


Let`s Connect