Added "Copy yaw" button to HDRIs
The button is only shown to people with the right to edit the current node. I've also simplified some CSS, with the help of @venomgfx.
This commit is contained in:
@@ -48,11 +48,18 @@
|
||||
data-toggle="tooltip",
|
||||
data-placement="bottom",
|
||||
title="{{ node.properties.license_type }}")
|
||||
|
||||
i(class="pi-license-{{ node.properties.license_type }}")
|
||||
| {% endif %}
|
||||
| {% endif %}
|
||||
|
||||
| {% if write_access %}
|
||||
li.node-details-meta-list-item
|
||||
a.btn#copy_yaw(
|
||||
href='javascript:void(0);'
|
||||
title='Copies current yaw of panorama to the clipboard, so you can set it as default yaw.'
|
||||
) Copy yaw
|
||||
| {% endif %}
|
||||
|
||||
| {% if node.properties.files %}
|
||||
li.btn-group.node-details-meta-list-item.video.download(
|
||||
title="Download HDRI")
|
||||
@@ -114,6 +121,8 @@ include ../_scripts
|
||||
| {% endblock %}
|
||||
|
||||
| {% block footer_scripts %}
|
||||
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/clipboard.min.js')}}")
|
||||
|
||||
script.
|
||||
$('#asset-license').popover();
|
||||
// Generate GA pageview
|
||||
@@ -130,4 +139,19 @@ script.
|
||||
$(this).removeClass('active').hide().html();
|
||||
});
|
||||
|
||||
$().ready(function () {
|
||||
new Clipboard('#copy_yaw', {
|
||||
text: function(trigger) {
|
||||
var frame = document.getElementById('vrview_window').contentWindow;
|
||||
var yaw = frame.yaw();
|
||||
if (console)
|
||||
console.log('Current yaw is: ', yaw, ", which was copied to your clipboard.");
|
||||
return yaw;
|
||||
}
|
||||
})
|
||||
.on('success', function(e) {
|
||||
$(e.trigger).flashOnce();
|
||||
});
|
||||
});
|
||||
|
||||
| {% endblock %}
|
||||
|
@@ -18,8 +18,6 @@ html(lang='en')
|
||||
script.
|
||||
/** Returns the current yaw in degrees. */
|
||||
function yaw() {
|
||||
console.log('default yaw:', worldRenderer.sceneInfo.defaultYaw * 180 / Math.PI);
|
||||
console.log('camera rotation: ', worldRenderer.camera.rotation.y * 180 / Math.PI);
|
||||
var the_yaw = worldRenderer.sceneInfo.defaultYaw + worldRenderer.camera.rotation.y;
|
||||
return the_yaw * 180 / Math.PI;
|
||||
}
|
||||
|
Reference in New Issue
Block a user