Skip to content

Commit

Permalink
fix(level_editor): Highlight selected road piece (#1475)
Browse files Browse the repository at this point in the history
* fix(level_editor): Highlight selected road piece

fixes: #1153

* Merge branch 'master' into fix/improve-highlight-for-selected-road-piece

Co-Authored-By: Florian Aucomte <33633200+faucomte97@users.noreply.github.com>
  • Loading branch information
Ricardo-MT and faucomte97 authored Aug 31, 2023
1 parent 52a7280 commit cdc9f85
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions game/static/game/css/level_editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ input {
text-align: center;
}

.mode_panel.unselected{
border-width: 0;
}

.mode_panel img {
width: 70px;
margin-left: 11px;
Expand Down
28 changes: 24 additions & 4 deletions game/static/game/js/level_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,26 @@ ocargo.LevelEditor = function(levelId) {
var paper = $('#paper'); // May as well cache this

var modes = {
ADD_ROAD_MODE: {name: gettext('Add road'), url: ocargo.Drawing.imageDir + "icons/add_road.svg"},
DELETE_ROAD_MODE: {name: gettext('Delete road'), url: ocargo.Drawing.imageDir + "icons/delete_road.svg"},
MARK_DESTINATION_MODE: {name: gettext('Mark end'), url: ocargo.Drawing.imageDir + "icons/destination.svg"},
MARK_ORIGIN_MODE: {name: gettext('Mark start'), url: ocargo.Drawing.imageDir + "icons/origin.svg"}
ADD_ROAD_MODE: {
name: gettext('Add road'),
url: ocargo.Drawing.imageDir + 'icons/add_road.svg',
id: 'add_road',
},
DELETE_ROAD_MODE: {
name: gettext('Delete road'),
url: ocargo.Drawing.imageDir + 'icons/delete_road.svg',
id: 'delete_road',
},
MARK_DESTINATION_MODE: {
name: gettext('Mark end'),
url: ocargo.Drawing.imageDir + 'icons/destination.svg',
id: 'end',
},
MARK_ORIGIN_MODE: {
name: gettext('Mark start'),
url: ocargo.Drawing.imageDir + 'icons/origin.svg',
id: 'start',
},
};

/*********/
Expand Down Expand Up @@ -235,6 +251,10 @@ ocargo.LevelEditor = function(levelId) {
function changeCurrentToolDisplay(mode){
$('#currentToolText').text(mode.name);
$('#currentToolIcon').attr("src", mode.url);
Object.values(modes).forEach((element) => {
$(`#${element.id}`).addClass('unselected');
});
$(`#${mode.id}`).removeClass('unselected');
}

function setupMapTab() {
Expand Down

0 comments on commit cdc9f85

Please sign in to comment.