-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathx_pencil.js
More file actions
40 lines (31 loc) · 978 Bytes
/
x_pencil.js
File metadata and controls
40 lines (31 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
autowatch = 1;
inlets = 1;
outlets = 1;
include('scalingfunctions.js');
var t = this.patcher;
// -------------------------------------------------
// Size Manegment
output = new Global('player');
output.screensize;
var dim = new Array(2);
var overflow = new MaxobjListener(t.getnamed('overflow'),updatesize);
var iwidth = new MaxobjListener(t.getnamed('iwidth'),updatesize);
var iheight = new MaxobjListener(t.getnamed('iheight'),updatesize);
var imode = new MaxobjListener(t.getnamed('imode'),updatesize);
function updatesize() {
var gendraw = t.getnamed('gendraw');
var screenwidth = output.screensize[0];
var screenheight = output.screensize[1];
var ratio = screenwidth / screenheight;
var ov = overflow.getvalue();
var mode = imode.getvalue();
if (mode == 0)
{
dim = [screenwidth + ov,screenheight + Math.floor(ov/ratio)];
}
else {
dim = [iwidth.getvalue(),iheight.getvalue()];
}
gendraw.message('dim', dim);
gendraw.message('ratio', ratio);
}