docs: function(clientX, clientY, layer, out) {
              out = out || {};
              var doc = document.documentElement;
              var body = document.body;
              var view;
              // The branch here is to deal with the fact that the viewport position is the distance TO the origin, not from
              // But the _viewportRect is the opposite -- it uses the same convention as a rectangle that matches the viewport in that layer
              // At some point this should be simplified, probably by altering the viewport to use the more intuitive coordinates
              if (layer) {
                  view = layer._viewportRect();
                  out.x =
                      (clientX -
                          Crafty.stage.x +
                          ((doc && doc.scrollLeft) ||
                              (body && body.scrollLeft) ||
                              0)) /
                          view._scale +
                      view._x;
                  out.y =
                      (clientY -
                          Crafty.stage.y +
                          ((doc && doc.scrollTop) ||
                              (body && body.scrollTop) ||
                              0)) /
                          view._scale +
                      view._y;
              } else {
                  view = Crafty.viewport;
                  out.x =
                      (clientX -
                          Crafty.stage.x +
                          ((doc && doc.scrollLeft) ||
                              (body && body.scrollLeft) ||
                              0)) /
                          view._scale -
                      view._x;
                  out.y =
                      (clientY -
                          Crafty.stage.y +
                          ((doc && doc.scrollTop) ||
                              (body && body.scrollTop) ||
                              0)) /
                          view._scale -
                      view._y;
              }
              return out;
          }