Colors now can be changed

This commit is contained in:
Daniel Brunner
2016-11-30 12:02:18 +01:00
parent bb96f88823
commit 4e84c98a1b
2 changed files with 13 additions and 4 deletions

View File

@@ -12,7 +12,6 @@
position: absolute; position: absolute;
width: 30px; width: 30px;
height: 30px; height: 30px;
background-color: #000;
} }
</style> </style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
@@ -98,7 +97,7 @@
</form> </form>
</fieldset> </fieldset>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-2">
<fieldset> <fieldset>
<legend>Kollisionen:</legend> <legend>Kollisionen:</legend>
@@ -121,7 +120,7 @@
</table> </table>
</fieldset> </fieldset>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-6">
<fieldset> <fieldset>
<legend>Segmente:</legend> <legend>Segmente:</legend>
@@ -133,6 +132,7 @@
<th>ID</th> <th>ID</th>
<th>Position</th> <th>Position</th>
<th>Geschwindigkeit</th> <th>Geschwindigkeit</th>
<th>Farbe</th>
<th>Aktionen</th> <th>Aktionen</th>
</tr> </tr>
</thead> </thead>

View File

@@ -144,14 +144,23 @@ $(document).ready(function($) {
this.id = entityId++; this.id = entityId++;
this.position = new Vector2(); this.position = new Vector2();
this.speed = new Vector2(); this.speed = new Vector2();
this.elem = $('<div>').addClass('point').appendTo('body'); var elem = this.elem = $('<div>').addClass('point').appendTo('body');
this.row = $('<tr>').appendTo('#table_entities'); this.row = $('<tr>').appendTo('#table_entities');
this.columns = { this.columns = {
id: $('<td>').text(this.id).appendTo(this.row), id: $('<td>').text(this.id).appendTo(this.row),
position: $('<td>').appendTo(this.row), position: $('<td>').appendTo(this.row),
speed: $('<td>').appendTo(this.row), speed: $('<td>').appendTo(this.row),
color: $('<td>').appendTo(this.row),
actions: $('<td>').appendTo(this.row), actions: $('<td>').appendTo(this.row),
} }
$('<input />')
.attr('type', 'color')
.change(function(){
console.log($(this).val());
elem.css('background-color', $(this).val());
})
.appendTo(this.columns.color)
.change();
} }
}; };