javascript - Css3 transform touch input -


i have transform 3d on map object, however, when transform whole map touch input doesn't follow , results in panning not functioning when rotating map full 180 controls inverted.

is there way tell css invert or rotate way touch inputs read browser allow normal panning when map rotated.

  • i know isn't preferred way of rotating map, library should have function in case, doesn't , solution rotate whole div containing map.

what wondering way either css or override angular in way modify touch on 360-degree variable.

the map changes rotation frequently, can't static solution.

css used rotate map:

transform-origin: 50% 50%; transform: rotate({{deg}}deg); transition: 300ms ease-out; 

code behind is:

$scope.degraw = math.round(heading.magneticheading);  var ar; $scope.rot = $scope.rot || 0; // if rot undefined or 0, make 0, else rot ar = $scope.rot % 360; if ( ar < 0 ) { ar += 360; } if ( ar < 180 && ($scope.degraw > (ar + 180)) ) { $scope.rot -= 360; } if ( ar >= 180 && ($scope.degraw <= (ar - 180)) ) { $scope.rot += 360; }  $scope.rot += ($scope.degraw - ar);   if($scope.isincompass == 1) {    $scope.deg = $scope.rot * -1;    $scope.northdeg = $scope.rot * -1;  } 

the panning , movement controlled map library, code i've been able out of library (might not code @ atleast i'm looking @ right now)

_touchmove: function(a) {         a.preventdefault();         this._updatetouch(a);         var b = this._touches,             c, d = a.changedtouches.length,             f, e, g, h;         if (!(l("android") && l("safari") && 1 === a.targettouches.length && a.touches.length === a.targettouches.length && a.targettouches.length === a.changedtouches.length && 0 === a.changedtouches[0].identifier && b[a.changedtouches[0].identifier] && 1 < this._touchids.length)) {             (c = 0; c < d; c++)                 if (f = a.changedtouches[c], e = b[f.identifier]) g = math.abs(f.pagex -                     e.startx), f = math.abs(f.pagey - e.starty), !e.moved && (g >= this.tapradius || f >= this.tapradius) && (e.moved = e.absmoved = !0), h = h ? h : e.moved;             1 === this._numtouches ? (b = a.changedtouches[0], this._swipeactive ? this._fire("onswipemove", this._processtouchevent(a, b)) : h && (this._swipeactive = !0, this._fire("onswipestart", this._processtouchevent(a, b)))) : 2 === this._numtouches && (c = this._nodetouches[0], d = this._nodetouches[1], this._pinchactive ? this._fire("onpinchmove", this._processtouchevent(a, [c, d])) : h && (h = b[c.identifier], e = b[d.identifier],                 b = math.abs(h.startx - e.startx), h = math.abs(h.starty - e.starty), e = math.abs(c.pagex - d.pagex), g = math.abs(c.pagey - d.pagey), math.abs(math.sqrt(e * e + g * g) - math.sqrt(b * b + h * h)) >= 2 * this.tapradius && (this._pinchactive = !0, this._fire("onpinchstart", this._processtouchevent(a, [c, d])))))         }     }, 

i cannot understand touch code, point should transform input follow rotation:

get rotation matrix:

var radians = deg / 180 * math.pi; var cos = math.cos(radians), sin = math.sin(radians); var matrix = [cos, sin, -sin, cos];  

get rotated touch point:

   var rotatedx = matrix[0] * p.x + matrix[2] * p.y;    var rotatedy = matrix[1] * p.x + matrix[3] * p.y; 

at point if not have knowledge of how input handled can this:

var originaltouchmove = _touchmove; _touchmove = function(a) {   // inspect , find clientx , clienty are.   // obtain rotatedx , rotatedy , overwrite them   originaltouchmove(a) // has been mutated rotated coords } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -