Glimmr Canvas-Based Drawing

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Chapter - Converting screen to image-map coordinates

    [This phrase can only be used after the element scaling rules for the image-map have been followed.]

    To decide what list of numbers is the equivalent of screen coordinate/coordinates/-- (coord1 - a list of numbers) in the/-- internal/-- coordinates of (grid - an image-map) image-map/--:
        let x1 be entry 1 of coord1;
        let y1 be entry 2 of coord1;
        let dx be x1 - win-x of grid;
        let dy be y1 - win-y of grid;
        let dx be (dx / scaled tile-width of grid) + 1;
        let dy be (dy / scaled tile-height of grid) + 1;
        let L be a list of numbers;
        add dx to L;
        add dy to L;
        decide on L.