Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Official stuff - description resize, quest icon support #143

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed item description
  • Loading branch information
andre9x committed Jul 15, 2017
commit 42db76dbc939faece4b58256f25121b3cfebfcea
3 changes: 2 additions & 1 deletion src/UI/Components/ItemInfo/ItemInfo.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions src/UI/Components/ItemInfo/ItemInfo.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<div class="ItemInfo" data-background="basic_interface/collection_bg.bmp">
<div class="container">
<div class="collection"></div>
<button class="view" data-background="basic_interface/btn_view.bmp" data-down="basic_interface/btn_view_a.bmp" data-hover="basic_interface/btn_view_b.bmp"></button>
<div class="title"></div>
<button class="close" data-background="basic_interface/sys_close_off.bmp" data-hover="basic_interface/sys_close_on.bmp"></button>
<div class="description"></div>
</div>
<div class="ItemInfo">
<div class="container" data-background="basic_interface/collection_bg.bmp">
<div class="collection"></div>
<button class="view" data-background="basic_interface/btn_view.bmp" data-down="basic_interface/btn_view_a.bmp" data-hover="basic_interface/btn_view_b.bmp"></button>
<div class="title"></div>
<button class="close" data-background="basic_interface/sys_close_off.bmp" data-hover="basic_interface/sys_close_on.bmp"></button>
<div class="description">
<div class="description-inner">
</div>
</div>
<button class="extend" data-background="btn_resize.bmp"></button>
</div>
<div class="cardlist">
<div class="border">
</div>
74 changes: 71 additions & 3 deletions src/UI/Components/ItemInfo/ItemInfo.js
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ define(function(require)
var Client = require('Core/Client');
var KEYS = require('Controls/KeyEventHandler');
var CardIllustration = require('UI/Components/CardIllustration/CardIllustration');
var Mouse = require('Controls/MouseEventHandler');
var UIManager = require('UI/UIManager');
var UIComponent = require('UI/UIComponent');
var htmlText = require('text!./ItemInfo.html');
@@ -62,6 +63,7 @@ define(function(require)
// Seems like "EscapeWindow" is execute first, push it before.
var events = jQuery._data( window, 'events').keydown;
events.unshift( events.pop() );
resize(ItemInfo.ui.find('.container').height());
};


@@ -80,7 +82,7 @@ define(function(require)
ItemInfo.init = function init()
{
this.ui.css({ top: 200, left:200 });

this.ui.find('.extend').mousedown(onResize);
this.ui.find('.close')
.mousedown(function(event){
event.stopImmediatePropagation();
@@ -116,7 +118,7 @@ define(function(require)


ui.find('.title').text( item.IsIdentified ? it.identifiedDisplayName : it.unidentifiedDisplayName );
ui.find('.description').text( item.IsIdentified ? it.identifiedDescriptionName : it.unidentifiedDescriptionName );
ui.find('.description-inner').text( item.IsIdentified ? it.identifiedDescriptionName : it.unidentifiedDescriptionName );

// Add view button (for cards)
if (item.type === ItemType.CARD) {
@@ -154,6 +156,8 @@ define(function(require)
}
break;
}

resize(ItemInfo.ui.find('.container').height());
};


@@ -205,7 +209,71 @@ define(function(require)
});
}


/**
* Extend SkillList window size
*/
function onResize()
{
var ui = ItemInfo.ui;
var top = ui.position().top;
var left = ui.position().left;
var lastHeight = 0;
var _Interval;

function resizing()
{
var h = Math.floor((Mouse.screen.y - top));
if (h === lastHeight) {
return;
}
resize( h );
lastHeight = h;
}

// Start resizing
_Interval = setInterval(resizing, 30);

// Stop resizing on left click
jQuery(window).on('mouseup.resize', function(event){
if (event.which === 1) {
clearInterval(_Interval);
jQuery(window).off('mouseup.resize');
}
});
}


/**
* Extend Item window size
*
* @param {number} height
*/
function resize( height )
{
var container = ItemInfo.ui.find('.container');
var description = ItemInfo.ui.find('.description');
var descriptionInner = ItemInfo.ui.find('.description-inner');
var containerHeight = height;
var minHeight = 120;
var maxHeight = (descriptionInner.height() + 45 > 120) ? descriptionInner.height() + 45 : 120;

if (containerHeight <= minHeight) {
containerHeight = minHeight;
}

if (containerHeight >= maxHeight) {
containerHeight = maxHeight;
}

container.css({
height: containerHeight
});
description.css({
height: containerHeight - 45
});
}


/**
* Create component and export it
*/