-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinject.js
More file actions
39 lines (29 loc) · 842 Bytes
/
Copy pathinject.js
File metadata and controls
39 lines (29 loc) · 842 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
$(document).ready(function() {
setInterval(checkForDialog, 500);
});
function checkForDialog() {
var element = $('#drawing-dialog');
if (element.length > 0) {
if ($('#drawing-dialog .extended-toolbar').length === 0) {
modifyDrawingDialog(element);
}
}
}
function getCanvas() {
return $('#drawing-dialog .canvas');
}
function drawShape(obj) {
window['draw' + capitalize(obj.type)](obj);
}
function drawRect(obj) {
$('#drawing-dialog .rectangle').simulate('click');
var xf = obj.x + obj.width;
var yf = obj.y + obj.height;
$('#drawing-dialog .canvas')
.simulate('mousedown', {clientX: x, clientY: y})
.simulate('mousemove', {clientX: xf, clientY: yf})
.simulate('mouseup', {clientX: xf, clientY: yf});
}
function capitalize(string) {
return string[0].toUpperCase() + string.slice(1);
}