I added the zooming code you linked and it works great. However, when i zoom in or out and then move the image with middle mouse button, the zoom resets to default value. I read through the code and noticed this:
sf::Vector2f pos((float)mPos_old.x-mPos.x, (float)mPos_old.y-mPos.y);
camera.move(pos.x, pos.y);
window.setView(camera); // If i remove this, i cant move the image but zoom works.
// If i dont remove it, zooming works but resets whe image is moved.
I also managed to make the view movable like i wanted but there is a little problem with it.
When i zoom out it moves very slowly and when i zoom in it goes way too fast when moving it.
This is because the size of the world co-ordinates are smaller when you zoom out and larger when you zoom in. You should consider converting the pixel co-ordinates of the mouse position to world co-ordinates.
If you're using views at all, you should really read that entire tutorial and make sure you fully understand it. It can be really confusing at first!
You find that this Wiki Tutorial explains the concept a little more clearly.
I tried multiplying the x and y values with the size of the view like:
Although the solution was given in my previous paragraph, I wanted to just say that the multiplication would needed to have been multiplied by the ratio of the view size to the window size. I don't know where you got the 32 from...
I tried to convert the pixel coordinates like you suggested:
sf::Vector2f pos = window.mapPixelToCoords(sf::Vector2i(mPos_old.x-mPos.x,mPos_old.y-mPos.y));
camera.move(pos.x, pos.y);
window.setView(camera);
but when i try to move the image it just moves somewhere really fast.
I read the view tutorial couple of times but i still cant get the hang of it
I will read it again but if you could provide some kind of example of how i should convert them i would appreciate that very much.