Skip to content

Commit 3820ddb

Browse files
committedOct 9, 2019
Toolbar simple layout
1 parent 62e7aae commit 3820ddb

File tree

7 files changed

+51
-35
lines changed

7 files changed

+51
-35
lines changed
 

‎data/data.json

+8-12
Original file line numberDiff line numberDiff line change
@@ -85143,17 +85143,13 @@
8514385143
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZAgMAAAC5h23wAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAxQTFRFAAAATU1NTU1NTU1NwlMHHwAAAAR0Uk5TAOvhxbpPrUkAAAAkSURBVHicY2BgYHBggAByabxg1WoGBq2pRCk9AKUbcND43AEAufYHlSuusE4AAAAASUVORK5CYII="
8514485144
},
8514585145
{
85146-
"group": "Lines",
85147-
"tools": [
85148-
{
85149-
"type": "LineToolSegment",
85150-
"icon": ""
85151-
},
85152-
{
85153-
"type": "LineToolExtended",
85154-
"icon": ""
85155-
}
85156-
]
85146+
"type": "LineToolSegment",
85147+
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZAgMAAAC5h23wAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAlQTFRFAAAATU1NJCQkCxcHIQAAAAN0Uk5TAP8SmutI5AAAACxJREFUeJxjYMACGAMgNAsLdpoVKi8AVe8A1QblQlWRKt0AoULw2w1zGxoAABdiAviQhF/mAAAAAElFTkSuQmCC"
85148+
},
85149+
{
85150+
"type": "LineToolExtended",
85151+
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZAQMAAAD+JxcgAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAZQTFRFAAAATU1NkJ+rOQAAAAJ0Uk5TAP9bkSK1AAAANElEQVR4nGNggABGEMEEIlhABAeI+AASF0AlHmAqA4kzKAAx8wGQuAMKwd6AoYzBAWonAwAcLwTgNfJ3RQAAAABJRU5ErkJggg=="
8515785152
}
85158-
]
85153+
],
85154+
"tool": "Cursor"
8515985155
}

‎src/TradingVue.vue

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export default {
114114
},
115115
colorTbBorder: {
116116
type: String,
117+
default: '#8282827d'
117118
},
118119
font: {
119120
type: String,

‎src/components/Toolbar.vue

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<div class="trading-vue-toolbar" :style="styles">
44
<toolbar-item v-for="(tool, i) in data.tools"
55
:key="i"
6-
:data="tool">
6+
:data="tool"
7+
:config="config"
8+
:selected="tool.type === data.tool">
79
</toolbar-item>
810
</div>
911
</template>
@@ -28,18 +30,19 @@ export default {
2830
let w = this.$props.config.TOOLBAR - b
2931
let c = colors.colorGrid
3032
let cb = colors.colorTbBack || colors.colorBack
31-
let brd = colors.colorTbBorder || colors.colorGrid
33+
let brd = colors.colorTbBorder || colors.colorScale
34+
let st = this.$props.config.TB_B_STYLE
3235
return {
3336
'width': `${w}px`,
3437
'height': `${this.$props.height}px`,
3538
'background-color': cb,
36-
'border-right': `${b}px solid ${brd}`
39+
'border-right': `${b}px ${st} ${brd}`
3740
}
3841
}
3942
},
4043
watch: {
4144
data() {
42-
console.log(this.$props.data.tools)
45+
console.log(this.$props.data)
4346
}
4447
}
4548
}
@@ -51,5 +54,6 @@ export default {
5154
position: absolute;
5255
border-right: 1px solid black;
5356
z-index: 100;
57+
padding-top: 4px;
5458
}
5559
</style>

‎src/components/ToolbarItem.vue

+29-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
<template>
3-
<div class="trading-vue-tbitem" :style="styles">
3+
<div :class="['trading-vue-tbitem', selected ? 'selected-item' : '']"
4+
:style="item_style">
5+
<div class="trading-vue-tbicon"
6+
:style="icon_style">
7+
</div>
48
</div>
59
</template>
610

@@ -9,31 +13,30 @@
913
export default {
1014
name: 'ToolbarItem',
1115
props: [
12-
'data', 'colors', 'tv_id', 'config'
16+
'data', 'selected', 'colors', 'tv_id', 'config'
1317
],
1418
mounted() {
15-
console.log(this.$props.data)
19+
console.log(this.$props.selected)
1620
},
1721
computed: {
18-
styles() {
19-
/*let colors = this.$props.colors
20-
let b = this.$props.config.TB_BORDER
21-
let w = this.$props.config.TOOLBAR - b
22-
let c = colors.colorGrid
23-
let cb = colors.colorTbBack || colors.colorBack
24-
let brd = colors.colorTbBorder || colors.colorGrid
22+
item_style() {
23+
let conf = this.$props.config
24+
let im = conf.TB_ITEM_M
25+
let m = (conf.TOOLBAR - conf.TB_ICON) * 0.5 - im
26+
let s = conf.TB_ICON + im * 2
2527
return {
26-
'width': `${w}px`,
27-
'height': `${this.$props.height}px`,
28-
'background-color': cb,
29-
'border-right': `${b}px solid ${brd}`
30-
}*/
28+
'width': `${s}px`,
29+
'height': `${s}px`,
30+
'margin': `8px ${m}px 0px ${m}px`,
31+
'border-radius': '3px'
32+
}
33+
},
34+
icon_style() {
3135
return {
3236
'background-image': `url(${this.$props.data.icon})`,
3337
'width': '25px',
3438
'height': '25px',
35-
'margin': '15px',
36-
'filter': 'brightness(1.6) sepia(1) hue-rotate(120deg) saturate(6)'
39+
'margin': '5px'
3740
}
3841
}
3942
}
@@ -43,6 +46,15 @@ export default {
4346

4447
<style>
4548
.trading-vue-tbitem {
49+
}
50+
.trading-vue-tbitem:hover {
51+
background-color: #76878319;
52+
}
4653
54+
.trading-vue-tbicon {
55+
position: absolute;
56+
}
57+
.trading-vue-tbitem.selected-item .trading-vue-tbicon {
58+
filter: brightness(1.6) sepia(1) hue-rotate(110deg) saturate(6);
4759
}
4860
</style>

‎src/icons/Extended.png

175 Bytes
Loading

‎src/icons/Segment.png

171 Bytes
Loading

‎src/stuff/constants.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ const $SCALES = [0.05, 0.1, 0.2, 0.25, 0.5, 0.8, 1, 2, 5]
3131

3232
const ChartConfig = {
3333
SBMIN: 60, // Minimal sidebar px
34-
TOOLBAR: 60, // Toolbar width px
35-
TB_BORDER: 2, // Toolbar border px
34+
TOOLBAR: 57, // Toolbar width px
35+
TB_ICON: 25, // Toolbar icon size px
36+
TB_ITEM_M: 5, // Toolbar item margin px
37+
TB_BORDER: 1, // Toolbar border px
38+
TB_B_STYLE: 'dotted', // Toolbar border style
3639
EXPAND: 0.15, // %/100 of range
3740
CANDLEW: 0.6, // %/100 of step
3841
GRIDX: 100, // px

0 commit comments

Comments
 (0)
Please sign in to comment.