MCPcopy Create free account
hub / github.com/phaserjs/phaser / Extend

Function Extend

src/geom/line/Extend.js:30–52  ·  view source on GitHub ↗
(line, left, right)

Source from the content-addressed store, hash-verified

28 * @return {Phaser.Geom.Line} The modified Line instance.
29 */
30var Extend = function (line, left, right)
31{
32 if (right === undefined) { right = left; }
33
34 var length = Length(line);
35
36 var slopX = line.x2 - line.x1;
37 var slopY = line.y2 - line.y1;
38
39 if (left)
40 {
41 line.x1 = line.x1 - slopX / length * left;
42 line.y1 = line.y1 - slopY / length * left;
43 }
44
45 if (right)
46 {
47 line.x2 = line.x2 + slopX / length * right;
48 line.y2 = line.y2 + slopY / length * right;
49 }
50
51 return line;
52};
53
54module.exports = Extend;

Callers 15

phaser-core.jsFile · 0.50
phaser.jsFile · 0.50
index.jsFile · 0.50
index.jsFile · 0.50
index.jsFile · 0.50
index.jsFile · 0.50
index.jsFile · 0.50
AssignTilePropertiesFunction · 0.50
BaseSound.jsFile · 0.50
NoAudioSound.jsFile · 0.50

Calls 1

LengthFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…