[英]object.prototype javascript does delete new object
http://codepen.io/haikudoichi/pen/OPYBQN http://codepen.io/haikudoichi/pen/OPYBQN
Everything seems to be working except for the delete option. 除了delete选项,其他所有内容似乎都可以正常工作。 When I click on the circle object, I want to be able to delete it. 当我单击圆形对象时,我希望能够将其删除。 However it's acting funky. 然而,它表现得很时髦。
Is this correct? 这个对吗?
var sqrt = Math.sqrt((this.x - x)^2 + (this.y - y)^2);
I think you want to do this instead: 我认为您想改为这样做:
var sqrt = Math.sqrt(Math.pow(this.x - x, 2) + Math.pow(this.y - y, 2));
^
is the Bitwise XOR operator. ^
是按位XOR运算符。
“ ^ ”不起作用,请尝试以下操作:
var sqrt = Math.sqrt(((this.x - x) * (this.x - x)) + ((this.y - y) * (this.y - y)));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.