- theming support added

- not caching fake input color as private var because it doesn't work with themes
This commit is contained in:
jean-emmanuel 2016-03-21 19:48:26 +01:00
parent 8469c688d1
commit 6574b8465a
7 changed files with 31 additions and 10 deletions

View file

@ -23,7 +23,7 @@ MISC = {
PXSCALE = getComputedStyle(document.documentElement).getPropertyValue("--pixel-scale")
INITIALZOOM = PXSCALE
///////////////////////

View file

@ -11,7 +11,7 @@ module.exports = {
// fetch ids corresponding to the osc path
var path = data.path
var ids = WIDGETS_ID_BY_PATH[path]
for (i in ids) {
var id = ids[i]
// update
@ -77,6 +77,17 @@ module.exports = {
var data = data || event
utils.createPopup(icon('warning')+' '+data.title,data.text)
},
applyStyle: function(event,data){
var data = data || event
var style = document.createElement('style');
style.innerHTML = data;
document.body.appendChild(style);
if (data.indexOf('--pixel-scale')) {
PXSCALE = data.match(/--pixel-scale\s*:\s*([^;]*)/)[1]
INITIALZOOM = PXSCALE
}
}
}

View file

@ -34,7 +34,6 @@ var tabs = function() {
// if shift is pressed (native), or if there is no vertical scrollbar,
// or if mouse is on h-scrollbar
var scrollbarHeight = 20
var initialZoom = PXSCALE
var scrolls = function(){
$('html').on('mousewheel.zoom',function(e) {
// console.log(e)
@ -51,9 +50,9 @@ var scrolls = function(){
})
$(document).on('keydown.resetzoom', function(e){
if (e.keyCode==96||e.keyCode==48) {
PXSCALE = 1
PXSCALE = INITIALZOOM
document.documentElement.style.setProperty("--pixel-scale",'')
document.documentElement.style.setProperty("--pixel-scale",initialZoom)
document.documentElement.style.setProperty("--pixel-scale",PXSCALE)
}
})

View file

@ -1,5 +1,4 @@
(function ($) {
var color = String(getComputedStyle(document.documentElement).getPropertyValue("--color-text")).trim()
$.fn.fakeInput = function(options) {
var settings = $.extend({
@ -13,7 +12,7 @@
self.value = undefined
self.height = undefined
self.width = undefined
self.color = color
self.color = undefined
self.center = settings.align == 'center'
self.visible = false
@ -33,6 +32,7 @@
canvas.addClass('visible')
}
self.color = getComputedStyle(document.documentElement).getPropertyValue("--color-text")
self.height=height
self.width=width