Fixing an undefined error

Im getting


but the error s3eems to happen when I am dragging the object.
Here is the function

function drag(evt) {
  if (selectedElement) {
    evt.preventDefault();
    var coord = getMousePosition(evt);
    selectedElement.setAttributeNS(null, "x", coord.x - offset.x);
    selectedElement.setAttributeNS(null, "y", coord.y - offset.y);
	
            var dx = coord.x - offset.x;
            var dy = coord.y - offset.y;

            if (confined) {
                if (dx < minX) { dx = minX; }
                else if (dx > maxX) { dx = maxX; }
                if (dy < minY) { dy = minY; }
                else if (dy > maxY) { dy = maxY; }
            }

            transform.setTranslate(dx, dy);  
	}
}


Given I get the error when I drag it, how can I figure out what about transform, is the error coming from?

The error is saying that the transform variable is undefined. Is something missing that’s supposed to set up that transform variable?

Based on the structure, I think he’s trying to use the setTranslate method of the SVGTransform class.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.