Merge branch 'dk_arrow'
This commit is contained in:
commit
2d13b28ae6
Binary file not shown.
Before Width: | Height: | Size: 3.9 KiB |
@ -1,76 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<svg
|
<!-- Generator: Adobe Illustrator 25.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
viewBox="0 0 330 330" style="enable-background:new 0 0 330 330;" xml:space="preserve">
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
<style type="text/css">
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
.st0{display:none;}
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
.st1{fill:none;stroke:#ED6B21;stroke-width:17.0079;stroke-linecap:round;stroke-miterlimit:10;}
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
|
|
||||||
sodipodi:docname="toolbar_arrow.svg"
|
|
||||||
xml:space="preserve"
|
|
||||||
style="enable-background:new 0 0 330 330;"
|
|
||||||
viewBox="0 0 330 330"
|
|
||||||
y="0px"
|
|
||||||
x="0px"
|
|
||||||
id="Layer_1"
|
|
||||||
version="1.1"><metadata
|
|
||||||
id="metadata21"><rdf:RDF><cc:Work
|
|
||||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
|
||||||
id="defs19" /><sodipodi:namedview
|
|
||||||
inkscape:current-layer="Layer_1"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:window-y="-8"
|
|
||||||
inkscape:window-x="-8"
|
|
||||||
inkscape:cy="165"
|
|
||||||
inkscape:cx="165"
|
|
||||||
inkscape:zoom="3.0545455"
|
|
||||||
showgrid="false"
|
|
||||||
id="namedview17"
|
|
||||||
inkscape:window-height="1377"
|
|
||||||
inkscape:window-width="2560"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:pageopacity="0"
|
|
||||||
guidetolerance="10"
|
|
||||||
gridtolerance="10"
|
|
||||||
objecttolerance="10"
|
|
||||||
borderopacity="1"
|
|
||||||
bordercolor="#666666"
|
|
||||||
pagecolor="#ffffff" />
|
|
||||||
<style
|
|
||||||
id="style2"
|
|
||||||
type="text/css">
|
|
||||||
.st0{display:none;}
|
|
||||||
.st1{fill:none;stroke:#ED6B21;stroke-width:17.0079;stroke-linecap:round;stroke-miterlimit:10;}
|
|
||||||
</style>
|
</style>
|
||||||
<path
|
<path id="XMLID_28_" class="st0" d="M180,315V51.2l49.4,49.4c5.9,5.9,15.4,5.9,21.2,0c5.9-5.9,5.9-15.4,0-21.2l-75-75
|
||||||
d="M180,315V51.2l49.4,49.4c5.9,5.9,15.4,5.9,21.2,0c5.9-5.9,5.9-15.4,0-21.2l-75-75 c-5.9-5.9-15.4-5.9-21.2,0l-75,75C76.5,82.3,75,86.2,75,90s1.5,7.7,4.4,10.6c5.9,5.9,15.4,5.9,21.2,0L150,51.2V315 c0,8.3,6.7,15,15,15S180,323.3,180,315z"
|
c-5.9-5.9-15.4-5.9-21.2,0l-75,75C76.5,82.3,75,86.2,75,90s1.5,7.7,4.4,10.6c5.9,5.9,15.4,5.9,21.2,0L150,51.2V315
|
||||||
class="st0"
|
c0,8.3,6.7,15,15,15S180,323.3,180,315z"
|
||||||
id="XMLID_28_" />
|
style="fill:#ed6b21;"/>
|
||||||
<g
|
<g id="XMLID_1_">
|
||||||
id="XMLID_1_">
|
<g>
|
||||||
<g
|
</g>
|
||||||
id="g5">
|
<g>
|
||||||
</g>
|
<polyline class="st1" points="113.6,84.5 164.3,18.3 164.3,18.3 "/>
|
||||||
<g
|
<polyline class="st1" points="216.4,84.5 164.3,18.3 164.3,18.3 "/>
|
||||||
id="g11">
|
</g>
|
||||||
<polyline
|
|
||||||
id="polyline7"
|
|
||||||
points="113.6,84.5 164.3,18.3 164.3,18.3 "
|
|
||||||
class="st1" />
|
|
||||||
<polyline
|
|
||||||
id="polyline9"
|
|
||||||
points="216.4,84.5 164.3,18.3 164.3,18.3 "
|
|
||||||
class="st1" />
|
|
||||||
</g>
|
|
||||||
</g>
|
</g>
|
||||||
<line
|
<line class="st1" x1="164.3" y1="263.3" x2="164.3" y2="18.3"/>
|
||||||
id="line14"
|
</svg>
|
||||||
y2="18.3"
|
|
||||||
x2="164.3"
|
|
||||||
y1="263.3"
|
|
||||||
x1="164.3"
|
|
||||||
class="st1" />
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.1 KiB |
@ -4438,13 +4438,7 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||||||
}
|
}
|
||||||
// init arrow
|
// init arrow
|
||||||
BackgroundTexture::Metadata arrow_data;
|
BackgroundTexture::Metadata arrow_data;
|
||||||
arrow_data.filename = "toolbar_arrow.png";
|
arrow_data.filename = "toolbar_arrow.svg";
|
||||||
// arrow_data.filename = "toolbar_arrow.svg";
|
|
||||||
//arrow_data.left = 16;
|
|
||||||
//arrow_data.top = 16;
|
|
||||||
//arrow_data.right = 16;
|
|
||||||
//arrow_data.bottom = 16;
|
|
||||||
|
|
||||||
arrow_data.left = 0;
|
arrow_data.left = 0;
|
||||||
arrow_data.top = 0;
|
arrow_data.top = 0;
|
||||||
arrow_data.right = 0;
|
arrow_data.right = 0;
|
||||||
|
@ -193,10 +193,9 @@ bool GLToolbar::init_arrow(const BackgroundTexture::Metadata& arrow_texture)
|
|||||||
std::string path = resources_dir() + "/icons/";
|
std::string path = resources_dir() + "/icons/";
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
if (!arrow_texture.filename.empty())
|
if (!arrow_texture.filename.empty()) {
|
||||||
res = m_arrow_texture.texture.load_from_file(path + arrow_texture.filename, false, GLTexture::SingleThreaded, false);
|
res = m_arrow_texture.texture.load_from_svg_file(path + arrow_texture.filename, false, false, false, 1000);
|
||||||
// res = m_arrow_texture.texture.load_from_svg_file(path + arrow_texture.filename, false, true, false, 100);
|
}
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
m_arrow_texture.metadata = arrow_texture;
|
m_arrow_texture.metadata = arrow_texture;
|
||||||
|
|
||||||
@ -1176,19 +1175,22 @@ void GLToolbar::render_arrow(const GLCanvas3D& parent, GLToolbarItem* highlighte
|
|||||||
float right = left + scaled_icons_size;
|
float right = left + scaled_icons_size;
|
||||||
|
|
||||||
unsigned int tex_id = m_arrow_texture.texture.get_id();
|
unsigned int tex_id = m_arrow_texture.texture.get_id();
|
||||||
|
// width and height of icon arrow is pointing to
|
||||||
float tex_width = (float)m_icons_texture.get_width();
|
float tex_width = (float)m_icons_texture.get_width();
|
||||||
float tex_height = (float)m_icons_texture.get_height();
|
float tex_height = (float)m_icons_texture.get_height();
|
||||||
|
// arrow width and height
|
||||||
|
float arr_tex_width = (float)m_arrow_texture.texture.get_width();
|
||||||
|
float arr_tex_height = (float)m_arrow_texture.texture.get_height();
|
||||||
|
if ((tex_id != 0) && (arr_tex_width > 0) && (arr_tex_height > 0)) {
|
||||||
|
float inv_tex_width = (arr_tex_width != 0.0f) ? 1.0f / arr_tex_width : 0.0f;
|
||||||
|
float inv_tex_height = (arr_tex_height != 0.0f) ? 1.0f / arr_tex_height : 0.0f;
|
||||||
|
|
||||||
if ((tex_id != 0) && (tex_width > 0) && (tex_height > 0)) {
|
float internal_left = left + border - scaled_icons_size * 1.5f; // add scaled_icons_size for huge arrow
|
||||||
float inv_tex_width = (tex_width != 0.0f) ? 1.0f / tex_width : 0.0f;
|
float internal_right = right - border + scaled_icons_size * 1.5f;
|
||||||
float inv_tex_height = (tex_height != 0.0f) ? 1.0f / tex_height : 0.0f;
|
|
||||||
|
|
||||||
float internal_left = left + border - scaled_icons_size / 2; // add half scaled_icons_size for huge arrow
|
|
||||||
float internal_right = right - border + scaled_icons_size / 2;
|
|
||||||
float internal_top = top - border;
|
float internal_top = top - border;
|
||||||
// bottom is not moving and should be calculated from arrow texture sides ratio
|
// bottom is not moving and should be calculated from arrow texture sides ratio
|
||||||
float arrow_sides_ratio = (float)m_arrow_texture.texture.get_height() / (float)m_arrow_texture.texture.get_width();
|
float arrow_sides_ratio = (float)m_arrow_texture.texture.get_height() / (float)m_arrow_texture.texture.get_width();
|
||||||
float internal_bottom = internal_top - (internal_right - internal_left) * arrow_sides_ratio;
|
float internal_bottom = internal_top - (internal_right - internal_left) * arrow_sides_ratio ;
|
||||||
|
|
||||||
float internal_left_uv = (float)m_arrow_texture.metadata.left * inv_tex_width;
|
float internal_left_uv = (float)m_arrow_texture.metadata.left * inv_tex_width;
|
||||||
float internal_right_uv = 1.0f - (float)m_arrow_texture.metadata.right * inv_tex_width;
|
float internal_right_uv = 1.0f - (float)m_arrow_texture.metadata.right * inv_tex_width;
|
||||||
|
@ -132,8 +132,7 @@ bool GLGizmosManager::init_arrow(const BackgroundTexture::Metadata& arrow_textur
|
|||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
if (!arrow_texture.filename.empty())
|
if (!arrow_texture.filename.empty())
|
||||||
res = m_arrow_texture.texture.load_from_file(path + arrow_texture.filename, false, GLTexture::SingleThreaded, false);
|
res = m_arrow_texture.texture.load_from_svg_file(path + arrow_texture.filename, false, false, false, 1000);
|
||||||
// res = m_arrow_texture.texture.load_from_svg_file(path + arrow_texture.filename, false, true, false, 100);
|
|
||||||
if (res)
|
if (res)
|
||||||
m_arrow_texture.metadata = arrow_texture;
|
m_arrow_texture.metadata = arrow_texture;
|
||||||
|
|
||||||
@ -1019,7 +1018,7 @@ void GLGizmosManager::render_arrow(const GLCanvas3D& parent, EType highlighted_t
|
|||||||
|
|
||||||
float arrow_sides_ratio = (float)m_arrow_texture.texture.get_height() / (float)m_arrow_texture.texture.get_width();
|
float arrow_sides_ratio = (float)m_arrow_texture.texture.get_height() / (float)m_arrow_texture.texture.get_width();
|
||||||
|
|
||||||
GLTexture::render_sub_texture(tex_id, zoomed_top_x + zoomed_icons_size * 1.2f, zoomed_top_x + zoomed_icons_size * 1.2f + zoomed_icons_size * arrow_sides_ratio, zoomed_top_y - zoomed_icons_size, zoomed_top_y, { { internal_left_uv, internal_bottom_uv }, { internal_left_uv, internal_top_uv }, { internal_right_uv, internal_top_uv }, { internal_right_uv, internal_bottom_uv } });
|
GLTexture::render_sub_texture(tex_id, zoomed_top_x + zoomed_icons_size * 1.2f, zoomed_top_x + zoomed_icons_size * 1.2f + zoomed_icons_size * 2.2f * arrow_sides_ratio, zoomed_top_y - zoomed_icons_size * 1.6f , zoomed_top_y + zoomed_icons_size * 0.6f, { { internal_left_uv, internal_bottom_uv }, { internal_left_uv, internal_top_uv }, { internal_right_uv, internal_top_uv }, { internal_right_uv, internal_bottom_uv } });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
zoomed_top_y -= zoomed_stride_y;
|
zoomed_top_y -= zoomed_stride_y;
|
||||||
|
Loading…
Reference in New Issue
Block a user