mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-18 22:22:09 +00:00
Changed map dragging functionality to use jQuery UI. This is an attempt to fix dragging on WINE.
This commit is contained in:
@@ -231,11 +231,12 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
margin: -8px 0 0 -8px;
|
|
||||||
background-image: url(uiIcons16Green.png);
|
background-image: url(uiIcons16Green.png);
|
||||||
background-position: -144px -96px;
|
background-position: -144px -96px;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
zoom: 0.125;
|
zoom: 0.125;
|
||||||
|
margin-left: -1px;
|
||||||
|
/*margin-bottom: -1px;*/
|
||||||
}
|
}
|
||||||
.mapIcon16.dead {
|
.mapIcon16.dead {
|
||||||
background-image: url(uiIcons16Red.png);
|
background-image: url(uiIcons16Red.png);
|
||||||
|
|||||||
@@ -79,8 +79,10 @@ body {
|
|||||||
|
|
||||||
#uiMapImage {
|
#uiMapImage {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 2px;
|
bottom: 1px;
|
||||||
left: -6px;
|
left: 1px;
|
||||||
|
width: 256px;
|
||||||
|
height: 256px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#uiMapContent {
|
#uiMapContent {
|
||||||
|
|||||||
2
nano/js/libraries.min.js
vendored
2
nano/js/libraries.min.js
vendored
File diff suppressed because one or more lines are too long
2523
nano/js/libraries/jquery-ui.js
vendored
Normal file
2523
nano/js/libraries/jquery-ui.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -63,7 +63,9 @@ NanoStateClass.prototype.onUpdate = function (data) {
|
|||||||
if (!this.mapInitialised)
|
if (!this.mapInitialised)
|
||||||
{
|
{
|
||||||
// Add drag functionality to the map ui
|
// Add drag functionality to the map ui
|
||||||
$('#uiMap').drags({handle : '#uiMapImage'});
|
$('#uiMap').draggable({
|
||||||
|
handle : '#uiMapImage'
|
||||||
|
});
|
||||||
|
|
||||||
$('#uiMapTooltip')
|
$('#uiMapTooltip')
|
||||||
.off('click')
|
.off('click')
|
||||||
|
|||||||
@@ -159,45 +159,3 @@ if (!String.prototype.ckey) {
|
|||||||
return this.replace(/\W/g, '').toLowerCase();
|
return this.replace(/\W/g, '').toLowerCase();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
(function($) {
|
|
||||||
$.fn.drags = function(opt) {
|
|
||||||
|
|
||||||
opt = $.extend({handle:"",cursor:"move"}, opt);
|
|
||||||
|
|
||||||
if(opt.handle === "") {
|
|
||||||
var $el = this;
|
|
||||||
} else {
|
|
||||||
var $el = this.find(opt.handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $el.css('cursor', opt.cursor).on("mousedown", function(e) {
|
|
||||||
if(opt.handle === "") {
|
|
||||||
var $drag = $(this).addClass('draggable');
|
|
||||||
} else {
|
|
||||||
var $drag = $(this).addClass('active-handle').parent().addClass('draggable');
|
|
||||||
}
|
|
||||||
var z_idx = $drag.css('z-index'),
|
|
||||||
drg_h = $drag.outerHeight(),
|
|
||||||
drg_w = $drag.outerWidth(),
|
|
||||||
pos_y = $drag.offset().top + drg_h - e.pageY,
|
|
||||||
pos_x = $drag.offset().left + drg_w - e.pageX;
|
|
||||||
$drag.css('z-index', 1000).parents().on("mousemove", function(e) {
|
|
||||||
$('.draggable').offset({
|
|
||||||
top:e.pageY + pos_y - drg_h,
|
|
||||||
left:e.pageX + pos_x - drg_w
|
|
||||||
}).on("mouseup", function() {
|
|
||||||
$(this).removeClass('draggable').css('z-index', z_idx);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
e.preventDefault(); // disable selection
|
|
||||||
}).on("mouseup", function() {
|
|
||||||
if(opt.handle === "") {
|
|
||||||
$(this).removeClass('draggable');
|
|
||||||
} else {
|
|
||||||
$(this).removeClass('active-handle').parent().removeClass('draggable');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
})(jQuery);
|
|
||||||
@@ -11,3 +11,6 @@ Used In File(s): \code\game\machinery\computer\crew.dm
|
|||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/for}}
|
{{/for}}
|
||||||
|
|
||||||
|
<div class="mapIcon mapIcon16 rank-captain alive" style="left: 10px; bottom: 10px;" unselectable="on"></div>
|
||||||
|
<div style="position: absolute; width: 1px; height: 1px; background: #00ff00; left: 10px; bottom: 10px;" unselectable="on"></div>
|
||||||
Reference in New Issue
Block a user