-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
134 lines (130 loc) · 5.72 KB
/
index.html
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Svg editor</title>
<link rel="stylesheet" href="style.css">
<script src="assets/jquery.min.js"></script>
<link rel="stylesheet" href="assets/bootstrap-modal/css/bootstrap.min.css">
<script src="assets/fabric.min.js"></script>
<script src="assets/jscolor.min.js"></script>
<script src="src/utils.js"></script>
<script src="assets/bootstrap-modal/js/bootstrap.min.js"></script>
<script type="text/javascript">
var idciSvgEditorConfig = {
// general settings
'canvas_id': 'canvas',
'canvas_container_id': 'canvas-container',
// handles settings
'corner_shift': 'in', // middle, in or out
'corner_size': 15,
'transparent_corners': true,
'corner_color': '#00D0AE',
'border_color': '#00D0AE',
// cursors settings
// 'moveCursor': 'url(/cursor.cur) 8 8, auto',
// plugins settings
'auto_save': {
'enable': false
},
'auto_image_resizer': {
'enable': true
},
'remove_object': {
'enable': true,
'input_id': 'remove-object'
},
'color_picker': {
'enable': true,
'input_id': 'color-picker'
},
'image_drag_and_drop': {
'enable': true,
'image_container_id': 'image-container'
},
'image_loader': {
'enable': true,
'file_input_id': 'image-loader'
},
'image_flipper': {
'enable_horizontal_flip': true,
'enable_vertical_flip': true,
'horizontal_flip_input_id': 'horizontalflip-modal-button',
'vertical_flip_input_id': 'verticalflip-modal-button'
},
'keyboard_listener': {
'enable_delete_object': true,
'enable_move_object': true
},
'manual_save': {
'enable': true,
'load_button_input_id': 'load-modal-button',
'save_button_input_d': 'save-modal-button',
'labels': {
'save': 'Save',
'save_this_project': 'Save this drawing',
'new_save': 'New save',
'override_save': 'Override',
'no_save_already': 'No save already',
'new_save_placeholder': 'Your title goes here...',
'load_project': 'Load a drawing',
'nothing_to_load': 'No drawings to load',
'load': 'Load',
'close': 'Close',
'title_already_used': 'This title is already used',
'title_not_blank': 'The title must be filled',
'delete': 'Delete'
}
},
'output_area': {
'enable': true,
'texarea_id': 'svg-output-area',
'enable_textarea_edition': false
}
};
</script>
<script
data-main="src/init"
data-configuration-variable="idciSvgEditorConfig"
data-editor-ready-function="editorReady"
src="assets/require.js">
</script>
<script type="text/javascript">
function editorReady(canvas) {
// do things with the canvas
canvas.on('object:selected', function() {
//console.log("selected");
});
canvas.on('selection:cleared', function() {
//console.log('cleared');
});
}
</script>
</head>
<body>
<span>Select an svg object and delete it</span><br/>
<input type="button" value="delete" id="remove-object"><br/><br/>
<input id="image-loader" type="file" name="picture"/><br/><br/>
<span>Drag and drop the images below</span>
<div id="image-container">
<img src="assets/svg/miaou.svg" width="50" height="50">
<img src="assets/svg/dance.svg" width="50" height="50">
<img src="assets/svg/gnu.svg" width="50" height="50">
<img src="assets/svg/tux.svg" width="50" height="50">
<img src="assets/svg/vroum.svg" width="50" height="50">
<img src="assets/svg/panda.svg" width="50" height="50">
<img src="assets/svg/bonjour.svg" width="50" height="50">
</div><br/>
<input id="load-modal-button" type="button" name="load" value="load a project"/>
<input id="save-modal-button" type="button" name="save" value="save a project"/><br/><br/>
<input id="horizontalflip-modal-button" type="button" name="horizontal-flip" value="horizontal flip"/>
<input id="verticalflip-modal-button" type="button" name="vertical-flip" value="vertical flip"/><br/><br/>
<span>Select an svg object and color it</span><br/>
<input id="color-picker" class="jscolor" value="000000" readonly="true"><br/><br/>
<div id="canvas-container">
<canvas id="canvas" width="220" height="415"></canvas>
</div><br/>
<textarea id="svg-output-area" rows="15" cols="50"></textarea>
</body>
</html>