Skip to content

Commit 74aa11d

Browse files
committed
label each module
1 parent fd16e47 commit 74aa11d

4 files changed

Lines changed: 37 additions & 16 deletions

File tree

‎css/stylesheet.css‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ section {
182182
visibility: visible;
183183
}
184184

185+
.module_wrapper .name {
186+
position: absolute;
187+
padding: 4px;
188+
font-size: 14px;
189+
background: rgb(44, 44, 44);
190+
}
191+
185192
.module_wrapper .wrapper {
186193
padding: 16px;
187194
box-sizing: border-box;

‎js/module/tracer.js‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
var Tracer = function (module) {
1+
function Tracer(module) {
22
this.module = module || Tracer;
33
this.capsule = tm.allocate(this);
4-
54
$.extend(this, this.capsule);
6-
return this.new;
7-
};
5+
if (this.new) {
6+
Tracer.prototype.init.call(this);
7+
return true;
8+
}
9+
return false;
10+
}
811

912
Tracer.prototype = {
13+
constructor: Tracer,
14+
init: function () {
15+
this.$container.append($('<span class="name">').text(this.name));
16+
},
1017
_setData: function () {
1118
tm.pushStep(this.capsule, {type: 'setData', arguments: arguments});
1219
},

‎js/module/tracer_manager.js‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ TracerManager.prototype = {
1515
module: tracer.module,
1616
tracer: tracer,
1717
allocated: true,
18+
name: null,
1819
$container: $container,
1920
new: true
2021
};
@@ -23,18 +24,25 @@ TracerManager.prototype = {
2324
},
2425
allocate: function (newTracer) {
2526
var selectedCapsule = null;
27+
var count = 0;
2628
$.each(this.capsules, function (i, capsule) {
27-
if (!capsule.allocated && capsule.module == newTracer.module) {
28-
capsule.tracer = newTracer;
29-
capsule.allocated = true;
30-
capsule.new = false;
31-
selectedCapsule = capsule;
32-
return false;
29+
if (capsule.module == newTracer.module) {
30+
count++;
31+
if (!capsule.allocated) {
32+
capsule.tracer = newTracer;
33+
capsule.allocated = true;
34+
capsule.new = false;
35+
selectedCapsule = capsule;
36+
return false;
37+
}
3338
}
3439
});
3540
if (selectedCapsule == null) {
41+
count++;
3642
selectedCapsule = this.add(newTracer);
3743
}
44+
console.log(newTracer);
45+
selectedCapsule.name = newTracer.constructor.name + count;
3846
return selectedCapsule;
3947
},
4048
deallocateAll: function () {
@@ -58,13 +66,13 @@ TracerManager.prototype = {
5866
place: function () {
5967
var capsules = this.capsules;
6068
$.each(capsules, function (i, capsule) {
61-
var width = $module_container.width();
62-
var height = $module_container.height() / capsules.length;
69+
var width = 100;
70+
var height = (100 / capsules.length);
6371
var top = height * i;
6472
capsule.$container.css({
65-
top: top,
66-
width: width,
67-
height: height
73+
top: top + '%',
74+
width: width + '%',
75+
height: height + '%'
6876
});
6977
capsule.tracer.resize();
7078
});

‎js/script.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ $(window).resize(function () {
263263
var dividers = [
264264
['v', $('.sidemenu'), $('.workspace')],
265265
['v', $('.viewer_container'), $('.editor_container')],
266-
['h', $('.module_container'), $('.tab_container')],
267266
['h', $('.data_container'), $('.code_container')]
268267
];
269268
for (var i = 0; i < dividers.length; i++) {

0 commit comments

Comments
 (0)