-
Notifications
You must be signed in to change notification settings - Fork 1
/
rectangle_interactor_demo.html
77 lines (64 loc) · 1.42 KB
/
rectangle_interactor_demo.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
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html, body {
height: 100%;
overflow: hidden;
}
svg {
float: left;
border-bottom: solid 1px #ccc;
border-right: solid 1px #ccc;
margin-right: -1px;
margin-bottom: -1px;
}
svg .interactors {
cursor: move;
}
</style>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="rectangle_interactor.js"></script>
<script>
var width = d3.select("body").node().clientWidth - 50,
height = d3.select("body").node().clientHeight - 50,
radius = 5;
var x = d3.scale.linear()
.domain([0,10])
.range([0, width])
var y = d3.scale.linear()
.domain([0, 10])
.range([height, 0]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var x0 = 5,
y0 = 5;
var opts1 = {
type:'Rectangle',
name:'roi_rectangle',
color1: '#ff0000',
color2: '#ff0000',
fill: "none",
showcenter: true,
show: false,
xmin: 5,
ymin: 5,
xmax: 6,
ymax: 6},
opts2 = {
type:'Rectangle',
name:'rectangle',
color1: '#0000ff',
color2: '#ffdddd',
showcenter: false,
fill: "#404040",
xmin: 2,
ymin: 2,
xmax: 4,
ymax: 4.5}
var rectangle1 = new rectangleInteractor(opts1, x, y);
var rectangle2 = new rectangleInteractor(opts2, x, y);
svg.call(rectangle1);
svg.call(rectangle2);
</script>