title: Gamemaker Zooming and Dragging
body: <p>I am currently using gamemaker to create a floorplan system. I am able to zoom into a room, drag and zoom out but how can i limit how much i can zoom in and out? The size of the room is 1024  by 768 px. I want to be able to zoom out to the way it originally looks when you first enter the room.</p>
  
  <p>This is my code currently which i have placed in the script:</p>
  
  <pre><code>X=view_xview[0];
  Y=view_yview[0];
  if mouse_check_button(mb_left){
  global.DRAG=true;
  window_set_cursor(cr_drag);
  view_xview-=vmx;
  view_yview-=vmy;
  }
  
  /*else{
  if !keyboard_check(vk_space){
      global.DRAG=false
  }
  window_set_cursor(cr_default);
  }
  */
  vmx=(mouse_x-X)-omx;
  omx=(mouse_x-X);
  vmy=(mouse_y-Y)-omy;
  omy=(mouse_y-Y);
  
  if mouse_wheel_up(){
  center_of_space_x=view_xview+view_wview/2;
  center_of_space_y=view_yview+view_hview/2;
  view_wview-=view_wview*0.15;
  view_hview-=view_hview*0.15;
  view_xview=center_of_space_x-view_wview/2;
  view_yview=center_of_space_y-view_hview/2;
  
  }
  if mouse_wheel_down(){
  center_of_space_x=view_xview+view_wview/2;
  center_of_space_y=view_yview+view_hview/2;
  view_wview+=view_wview*0.15;
  view_hview+=view_hview*0.15;
  view_xview=center_of_space_x-view_wview/2;
  view_yview=center_of_space_y-view_hview/2;
  }
  </code></pre>