From 751df786e55304d75c0bb439f0fb791a3b22c70f Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 19 Aug 2023 18:25:33 +0300 Subject: [PATCH] preparing to generalize basic collission detection... Signed-off-by: Alex A. Naanou --- grid-n-view.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/grid-n-view.js b/grid-n-view.js index cfa5b42..050ff20 100644 --- a/grid-n-view.js +++ b/grid-n-view.js @@ -165,6 +165,9 @@ function(evt, id){ // XXX constrain this to: // viewport -- DONE but needs to be smoother... // parent +// element +// ...might be a good idea to write a fast/generic containment +// tester... // XXX might be a good idea to allow bounds to be: // string - css selector // element - @@ -350,6 +353,37 @@ function(options={}){ document.addEventListener('mouseup', handleMoveEnd) } +// cmpRects(, ) +// -> 'contained' +// -> 'contains' +// -> 'intersect' +// -> 'appart' +// XXX should these pe separate checks -- speed??? +var cmpRects = function(rect, container){ + // XXX +} +var Containment = function(elem, parent){ + return Object.assign( + this instanceof Containment ? + obj + : { __proto__: Containment.prototype }, + { + elem, + parent, + }) } +Containment.prototype = { + // update rectangle data... + update: function(){ + // XXX + return self }, + check: function(){ + // XXX + }, +} + + + + //--------------------------------------------------------------------- // XXX add shift+arrow to select...