px scaling support on the way + some styles updates

This commit is contained in:
jean-emmanuel 2016-03-18 12:53:44 +01:00
parent f1e384ecc2
commit 60bd47465d
11 changed files with 50 additions and 35 deletions

File diff suppressed because one or more lines are too long

View file

@ -24,6 +24,14 @@ MISC = {
///////////////////////
$ = jQuery = require('./jquery/jquery.min')
///////////////////////
PXSCALE = 1
$('html').css('font-size',PXSCALE+'px')
///////////////////////
require('./jquery/jquery.ui')
require('./jquery/jquery.drag')
require('./jquery/jquery.resize')
@ -44,4 +52,7 @@ for (i in callbacks) {
}
///////////////////////
IPC.send('ready')

View file

@ -205,8 +205,8 @@ var editObject = function(container, data, refresh){
handleTarget = $(event.originalEvent.target)
},
stop: function( event, ui ) {
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.max(ui.size.height,30)
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.max(ui.size.width,30)
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.max(ui.size.height,30)/PXSCALE
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.max(ui.size.width,30)/PXSCALE
updateDom(container,data)
},
snap:'.tab.on .widget, .tab.on',
@ -218,8 +218,8 @@ var editObject = function(container, data, refresh){
container.draggable({
stop: function( event, ui ) {
event.preventDefault()
data.top = ui.helper.position().top + container.parent().scrollTop()
data.left = ui.helper.position().left + container.parent().scrollLeft()
data.top = (ui.helper.position().top + container.parent().scrollTop())/PXSCALE
data.left = (ui.helper.position().left + container.parent().scrollLeft())/PXSCALE
ui.helper.remove()
updateDom(container,data)
},

View file

@ -56,6 +56,7 @@ module.exports.create = function(widgetData,container) {
}
if (typeof widgetData.points=='string') {
widget.linkedWidgets.push(widgetData.points)
@ -115,13 +116,13 @@ module.exports.create = function(widgetData,container) {
for (i in widget.data) {
var newpoint = widget.data[i].length?
[
mapToScale(widget.data[i][0],[widgetData.rangeX.min,widgetData.rangeX.max],[15,widget.width-15],0,widgetData.logScaleX,true),
mapToScale(widget.data[i][1],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15,15],0,widgetData.logScaleY,true),
mapToScale(widget.data[i][0],[widgetData.rangeX.min,widgetData.rangeX.max],[15*PXSCALE,widget.width-15*PXSCALE],0,widgetData.logScaleX,true),
mapToScale(widget.data[i][1],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15*PXSCALE,15*PXSCALE],0,widgetData.logScaleY,true),
]
:
[
mapToScale(i,[0,widget.data.length-1],[15,widget.width-15],0,widgetData.logScaleX,true),
mapToScale(widget.data[i],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15,15],0,widgetData.logScaleY,true),
mapToScale(i,[0,widget.data.length-1],[15*PXSCALE,widget.width-15*PXSCALE],0,widgetData.logScaleX,true),
mapToScale(widget.data[i],[widgetData.rangeY.min,widgetData.rangeY.max],[widget.height-15*PXSCALE,15*PXSCALE],0,widgetData.logScaleY,true),
]
@ -144,17 +145,17 @@ module.exports.create = function(widgetData,container) {
point = newpoint
}
ctx.lineWidth = 1.5
ctx.lineWidth = 1.5*PXSCALE
ctx.strokeStyle= widget.lineColor
ctx.stroke()
ctx.font = '10px sans-serif'
ctx.font = PXSCALE * 10 + 'px sans-serif'
ctx.fillStyle = widget.textColor
ctx.textBaseline = "bottom"
ctx.textAlign = 'left'
ctx.fillText(widget.pips.x.min,12,widget.height)
ctx.fillText(widget.pips.x.min,12*PXSCALE,widget.height)
ctx.textAlign = 'right'
ctx.fillText(widget.pips.x.max,widget.width-10,widget.height)
@ -164,9 +165,9 @@ module.exports.create = function(widgetData,container) {
ctx.textBaseline = "top"
ctx.textAlign = 'left'
ctx.fillText(widget.pips.y.min,12,2)
ctx.fillText(widget.pips.y.min,12*PXSCALE,2*PXSCALE)
ctx.textAlign = 'right'
ctx.fillText(widget.pips.y.max,widget.height-10,2)
ctx.fillText(widget.pips.y.max,widget.height-10*PXSCALE,2*PXSCALE)
ctx.rotate(Math.PI/2)
ctx.restore()

View file

@ -109,8 +109,8 @@ module.exports.create = function(widgetData,container) {
for (var i=widget.length-1;i>=0;i=i-1) {
var newpoint = [
mapToScale(i,[0,widget.length-1],[15,widget.width-15],1),
mapToScale(widget.data[i],[widgetData.range.min,widgetData.range.max],[widget.height-15,15],1,widgetData.logScale,true),
mapToScale(i,[0,widget.length-1],[15*PXSCALE,widget.width-15*PXSCALE],1),
mapToScale(widget.data[i],[widgetData.range.min,widgetData.range.max],[widget.height-15*PXSCALE,15*PXSCALE],1,widgetData.logScale,true),
]
if (first) {
ctx.moveTo(newpoint[0],newpoint[1])
@ -126,11 +126,11 @@ module.exports.create = function(widgetData,container) {
point = newpoint
}
ctx.lineWidth = 1.5
ctx.lineWidth = 1.5*PXSCALE
ctx.strokeStyle= widget.lineColor
ctx.stroke()
ctx.font = '10px sans-serif'
ctx.font = PXSCALE * 10 + 'px sans-serif'
ctx.fillStyle = widget.textColor
@ -140,9 +140,9 @@ module.exports.create = function(widgetData,container) {
ctx.textBaseline = "top"
ctx.textAlign = 'left'
ctx.fillText(widget.pips.min,12,2)
ctx.fillText(widget.pips.min,12*PXSCALE,2*PXSCALE)
ctx.textAlign = 'right'
ctx.fillText(widget.pips.max,widget.height-10,2)
ctx.fillText(widget.pips.max,widget.height-10*PXSCALE,2*PXSCALE)
ctx.rotate(Math.PI/2)
ctx.restore()

View file

@ -50,7 +50,7 @@
if (!self.height || !self.width || (self.height==100 && self.width==100)) return
ctx.clearRect(0,0,self.width,self.height)
ctx.font = '13px Droid Sans'
ctx.font = PXSCALE * 13 + 'px Droid Sans'
ctx.textBaseline = "top"
ctx.fillStyle = self.color

View file

@ -111,7 +111,7 @@
left:0;
right:0;
bottom:0;
border:1px dashed $color-accent;
border:1rem dashed $color-accent;
pointer-events: none;
}

View file

@ -34,7 +34,7 @@ html, body {
}
html{
font-size: 1px;
font-size: 2px;
}
body {

View file

@ -97,14 +97,14 @@
}
}
.round {
content:"";
position:absolute;
top:15rem;
left:15rem;
right:15rem;
bottom:15rem;
top:16rem;
left:16rem;
right:16rem;
bottom:16rem;
border-radius:100%;
background:$color-raised;
box-shadow: 0 2rem 0 0 $color-faded;
}
.knob {
position:absolute;

View file

@ -25,7 +25,6 @@
border-bottom:0;
.strip > .widget {
max-width: 100%;
margin-top:-1rem;
}
}
&.horizontal {
@ -43,7 +42,6 @@
width: 100%;
min-height: 100%;
max-height: 100%;
margin-left:-1rem;
}
}

View file

@ -19,11 +19,16 @@
&.horizontal {
flex-direction:row;
.value {
padding:28rem 12rem 12rem 12rem;
padding:28rem 6rem 6rem 6rem;
text-align: center;
display: flex;
justify-content: center;
flex-direction: column;
border-top:0;
border-right:1rem solid $color-bg;
&:last-child {
border-right:0;
}
&:before {
left:50%;
top:8rem;
@ -32,9 +37,7 @@
margin-left: -4rem;
margin-top:0;
}
&:first-child {
border-top: 1rem solid $color-fg;
}
}
}
.value {
@ -43,12 +46,14 @@
width:100%;
height:100%;
position: relative;
border-top: 1rem solid $color-fg;
border-top: 1rem solid $color-bg;
padding:12rem 12rem 12rem 24rem ;
white-space: normal;
text-align: left;
word-break: break-all;
overflow: hidden;
border-bottom:2rem solid $color-faded;
&:last-child {
margin-bottom:0;