-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
98 lines (79 loc) · 3.01 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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="imageedit.css">
<title>Image — test page</title>
</head>
<body>
<div>
<button id="upload" type="file" formenctype="multipart/form-data">Загрузить изображение</button>
<button id="crop">Показать сетку</button>
<button id="crop-hide">Спрятать сетку</button>
<button id="crop-action">Обрезать картинку</button>
<button id="rotate-left">Повернуть налево</button>
<button id="rotate-right">Повернуть направо</button>
<button id="focus">Фокус</button>
<button id="focus-save">Сохранить фокус</button>
<div id="imageeditor" class="imageeditor-cont"></div>
</div>
<script src="../closurelibrary/closure/goog/base.js"></script>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="deps.js"></script>
<script src="dist/smoothzoom/jquery.smoothZoom.min.js"></script>
<script src="dist/hammer.js/hammer.min.js"></script>
<script type="text/javascript">
goog.require('DD.ui.image.Editor');
window.onload = function()
{
var target = document.getElementById('imageeditor');
var editor = new DD.ui.image.Editor();
editor.render(target);
editor.loadImage('1.jpg');
var cropBtn = document.getElementById('crop');
var cropHideBtn = document.getElementById('crop-hide');
var cropAction = document.getElementById('crop-action');
var rotateRight = document.getElementById('rotate-right');
var rotateLeft = document.getElementById('rotate-left');
var focus = document.getElementById('focus');
var focusSave = document.getElementById('focus-save');
cropBtn.addEventListener('click', function()
{
editor.instrumentCrop_show();
});
cropHideBtn.addEventListener('click', function()
{
editor.instrumentCrop_hide();
});
rotateRight.addEventListener('click', function()
{
editor.blockZoom(false);
editor.instrumentRotate_rotate(1);
});
rotateLeft.addEventListener('click', function()
{
editor.blockZoom(false);
editor.instrumentRotate_rotate(0);
});
cropAction.addEventListener('click', function()
{
editor.blockZoom(false);
editor.instrumentCrop_crop();
});
focus.addEventListener('click', function()
{
editor.instrumentFocus_show();
});
focusSave.addEventListener('click', function()
{
var coords = editor.instrumentFocus_getFocus();
editor.instrumentFocus_hide();
if (coords)
alert('Фокус сохранен по координатам(x: ' + coords.focusX + ' y: ' + coords.focusY);
});
};
</script>
</body>
</html>