Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public onMouseDown(event) {
this.animationIsRunning = 0;
this.lerps = 9999999999; // pause
var x;
var y;
//$("canvas-mouse-coords").text(Math.floor(event.downPoint['x']/100)+","+Math.floor(event.downPoint['y']/100));
//$("canvas-mouse-coords").text(Math.floor(event.downPoint['x']) + "," + -Math.floor(event.downPoint['y']));
//$("canvas-mouse-coords").css({ 'display': 'block', 'left': event.event.pageX, 'top': event.event.pageY });
for (var i = 0; i < this.numberOfEvacuees; i++) {
x = this.evacBalls.children[i].position.x;
y = this.evacBalls.children[i].position.y;
this.evacLabels.addChild(new Path.Circle({ center: new Point(x, y), radius: this.ballsSize * 1.4, fillColor: "#f80" }));
this.evacLabels.addChild(new PointText({ point: new Point(x - this.ballsSize / 1, y - this.ballsSize / 3), fillColor: "#000", content: "e" + i, fontFamily: 'Play', fontSize: this.ballsSize * 0.7 }));
this.evacLabels.addChild(new PointText({ point: new Point(x - this.ballsSize / 1, y + this.ballsSize / 2), fillColor: "#000", content: [Math.round(x / 100), Math.round(y / 100)], fontFamily: 'Play', fontSize: this.ballsSize * 0.7 }));
}
};
instance._applyProps = applyPathProps
break
case TYPES.CIRCLE:
instance = new Path.Circle(instanceProps)
instance._applyProps = applyCircleProps
break
case TYPES.ELLIPSE:
instance = new Path.Ellipse(instanceProps)
instance._applyProps = applyEllipseProps
break
case TYPES.RECTANGLE:
instance = new Path.Rectangle(instanceProps)
instance._applyProps = applyRectangleProps
break
case TYPES.POINTTEXT:
instance = new PointText(instanceProps)
instance._applyProps = applyPointTextProps
break
default:
invariant(instance, 'PaperReact does not support the type "%s"', type)
break
}
invariant(instance, 'PaperReact does not support the type "%s"', type)
//instance._applyProps(instance, props)
return instance
},
for (var i = 0; i < this.obstacles.length; i++) {
this.staticGeoms.addChild(new Path.Rectangle({ point: new Point(this.obstacles[i]["x0"], -this.obstacles[i]["y0"]), size: new Size(this.obstacles[i]["width"], -this.obstacles[i]["depth"]), strokeColor: this.colors['obsts'], strokeWidth: this.wallsSize }));
}
if (this.labelsSize != 0) {
for (var key in this.rooms) {
this.staticGeoms.addChild(new PointText({ point: new Point(this.rooms[key]["x0"] + 10, -this.rooms[key]["y0"] - 30), fillColor: this.colors["fg"], content: this.rooms[key]["name"], fontFamily: 'Play', fontSize: this.labelsSize }));
}
}
for (var key in this.doors) {
if (this.doorsSize != 0) {
this.staticGeoms.addChild(new Path.Rectangle({ point: new Point(this.doors[key]["x0"], -this.doors[key]["y0"]), size: new Size(this.doors[key]["width"], -this.doors[key]["depth"]), strokeColor: this.colors['door'], strokeWidth: this.doorsSize }));
}
if (this.labelsSize != 0) {
this.staticGeoms.addChild(new PointText({ point: new Point(this.doors[key]["center_x"] - 10, -this.doors[key]["center_y"] + 10), fillColor: this.colors["fg"], content: this.doors[key]["name"], opacity: 0.7, fontFamily: 'Play', fontSize: this.labelsSize * 0.75 }));
}
}
}
export function renderTextTarget(typeString, setString, position) {
let rendered = new paper.PointText(new paper.Point(position[0], position[1]));
rendered.justification = 'center';
rendered.fillColor = Colors.DEEP_PURPLE_500;
rendered.content = Registry.text;
rendered.fontSize = 10000/3;
return rendered;
}
export function renderText(feature){
//TODO - Figure out where to save the position of the feature
let position = feature.getValue("position");
let rendered = new paper.PointText(new paper.Point(position[0], position[1]));
rendered.justification = 'center';
rendered.fillColor = Colors.DEEP_PURPLE_500;
///rendered.content = feature.getText();
rendered.content = feature.getValue("text");
rendered.fontSize = 10000/3;
rendered.featureID = feature.getID();
return rendered;
}
g = this.dd_geoms['rectangles'][i];
this.staticGeoms.addChild(new Path.Rectangle({ point: new Point(g["xy"][0], -g["xy"][1]), size: new Size(g["width"], -g["depth"]), strokeColor: g['strokeColor'], strokeWidth: g['strokeWidth'], fillColor: g['fillColor'], opacity: g['opacity'] }));
}
for (var i = 0; i < this.dd_geoms['lines'].length; i++) {
g = this.dd_geoms['lines'][i];
this.staticGeoms.addChild(new Path.Line({ from: new Point(g["xy"][0], -g["xy"][1]), to: new Point(g["x1"], -g["y1"]), strokeColor: g['strokeColor'], strokeWidth: g['strokeWidth'], opacity: g['opacity'] }));
}
for (var i = 0; i < this.dd_geoms['circles'].length; i++) {
g = this.dd_geoms['circles'][i];
this.staticGeoms.addChild(new Path.Circle({ center: new Point(g["xy"][0], -g["xy"][1]), radius: g["radius"], fillColor: g['fillColor'], opacity: g['opacity'] }));
}
for (var i = 0; i < this.dd_geoms['texts'].length; i++) {
g = this.dd_geoms['texts'][i];
this.staticGeoms.addChild(new PointText({ point: new Point(g["xy"][0], -g["xy"][1]), content: g["content"], fontFamily: 'Play', fontSize: g["fontSize"], fillColor: g['fillColor'], opacity: g['opacity'] }));
}
}
>((_: State) => new PointText(new Point(0, 0)), options)