Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
morpheus.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daria Zenkova
morpheus.js
Commits
a620bde9
Commit
a620bde9
authored
Jun 15, 2016
by
Joshua Gould
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save image color bar size
parent
bc8c2428
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
58 deletions
+54
-58
js/morpheus-latest.min.js
js/morpheus-latest.min.js
+5
-5
src/tools/chart_tool2.js
src/tools/chart_tool2.js
+3
-5
src/ui/canvas_util.js
src/ui/canvas_util.js
+41
-40
src/ui/heat_map.js
src/ui/heat_map.js
+1
-3
src/ui/vector_track.js
src/ui/vector_track.js
+0
-2
src/ui/vector_track_header.js
src/ui/vector_track_header.js
+4
-3
No files found.
js/morpheus-latest.min.js
View file @
a620bde9
This diff is collapsed.
Click to expand it.
src/tools/chart_tool2.js
View file @
a620bde9
...
@@ -229,7 +229,7 @@ morpheus.ChartTool2 = function (chartOptions) {
...
@@ -229,7 +229,7 @@ morpheus.ChartTool2 = function (chartOptions) {
morpheus
.
ChartTool2
.
getPlotlyDefaults
=
function
()
{
morpheus
.
ChartTool2
.
getPlotlyDefaults
=
function
()
{
var
layout
=
{
var
layout
=
{
hovermode
:
'
closest
'
,
hovermode
:
'
closest
'
,
autosize
:
fals
e
,
autosize
:
tru
e
,
paper_bgcolor
:
'
rgb(255,255,255)
'
,
paper_bgcolor
:
'
rgb(255,255,255)
'
,
plot_bgcolor
:
'
rgb(229,229,229)
'
,
plot_bgcolor
:
'
rgb(229,229,229)
'
,
showlegend
:
false
,
showlegend
:
false
,
...
@@ -250,8 +250,7 @@ morpheus.ChartTool2.getPlotlyDefaults = function () {
...
@@ -250,8 +250,7 @@ morpheus.ChartTool2.getPlotlyDefaults = function () {
showline
:
false
,
showline
:
false
,
showticklabels
:
true
,
showticklabels
:
true
,
tickcolor
:
'
rgb(127,127,127)
'
,
tickcolor
:
'
rgb(127,127,127)
'
,
ticks
:
'
outside
'
,
ticks
:
'
outside
'
type
:
'
linear
'
},
},
yaxis
:
{
yaxis
:
{
zeroline
:
false
,
zeroline
:
false
,
...
@@ -263,8 +262,7 @@ morpheus.ChartTool2.getPlotlyDefaults = function () {
...
@@ -263,8 +262,7 @@ morpheus.ChartTool2.getPlotlyDefaults = function () {
showline
:
false
,
showline
:
false
,
showticklabels
:
true
,
showticklabels
:
true
,
tickcolor
:
'
rgb(127,127,127)
'
,
tickcolor
:
'
rgb(127,127,127)
'
,
ticks
:
'
outside
'
,
ticks
:
'
outside
'
type
:
'
linear
'
}
}
};
};
var
config
=
{
var
config
=
{
...
...
src/ui/canvas_util.js
View file @
a620bde9
morpheus
.
CanvasUtil
=
function
()
{
morpheus
.
CanvasUtil
=
function
()
{
};
};
morpheus
.
CanvasUtil
.
dragging
=
false
;
morpheus
.
CanvasUtil
.
dragging
=
false
;
morpheus
.
CanvasUtil
.
FONT_NAME
=
'
"Helvetica Neue",Helvetica,Arial,sans-serif
'
;
morpheus
.
CanvasUtil
.
FONT_NAME
=
'
"Helvetica Neue",Helvetica,Arial,sans-serif
'
;
morpheus
.
CanvasUtil
.
FONT_COLOR
=
'
rgb(34, 34, 34)
'
;
morpheus
.
CanvasUtil
.
FONT_COLOR
=
'
rgb(34, 34, 34)
'
;
morpheus
.
CanvasUtil
.
getPreferredSize
=
function
(
c
)
{
morpheus
.
CanvasUtil
.
getPreferredSize
=
function
(
c
)
{
var
size
=
c
.
getPreferredSize
();
var
size
=
c
.
getPreferredSize
();
var
prefWidth
=
c
.
getPrefWidth
();
var
prefWidth
=
c
.
getPrefWidth
();
var
prefHeight
=
c
.
getPrefHeight
();
var
prefHeight
=
c
.
getPrefHeight
();
...
@@ -24,7 +24,7 @@ if (typeof window !== 'undefined' && 'devicePixelRatio' in window) {
...
@@ -24,7 +24,7 @@ if (typeof window !== 'undefined' && 'devicePixelRatio' in window) {
}
}
}
}
morpheus
.
CanvasUtil
.
setBounds
=
function
(
canvas
,
bounds
)
{
morpheus
.
CanvasUtil
.
setBounds
=
function
(
canvas
,
bounds
)
{
var
backingScale
=
morpheus
.
CanvasUtil
.
BACKING_SCALE
;
var
backingScale
=
morpheus
.
CanvasUtil
.
BACKING_SCALE
;
if
(
bounds
.
height
!=
null
)
{
if
(
bounds
.
height
!=
null
)
{
...
@@ -43,7 +43,7 @@ morpheus.CanvasUtil.setBounds = function(canvas, bounds) {
...
@@ -43,7 +43,7 @@ morpheus.CanvasUtil.setBounds = function(canvas, bounds) {
}
}
};
};
morpheus
.
CanvasUtil
.
drawShape
=
function
(
context
,
shape
,
x
,
y
,
size2
)
{
morpheus
.
CanvasUtil
.
drawShape
=
function
(
context
,
shape
,
x
,
y
,
size2
)
{
if
(
size2
<
0
)
{
if
(
size2
<
0
)
{
return
;
return
;
}
}
...
@@ -125,20 +125,20 @@ morpheus.CanvasUtil.drawShape = function(context, shape, x, y, size2) {
...
@@ -125,20 +125,20 @@ morpheus.CanvasUtil.drawShape = function(context, shape, x, y, size2) {
context
.
stroke
();
context
.
stroke
();
};
};
morpheus
.
CanvasUtil
.
drawLine
=
function
(
context
,
x1
,
y1
,
x2
,
y2
)
{
morpheus
.
CanvasUtil
.
drawLine
=
function
(
context
,
x1
,
y1
,
x2
,
y2
)
{
context
.
beginPath
();
context
.
beginPath
();
context
.
moveTo
(
x1
,
y1
);
context
.
moveTo
(
x1
,
y1
);
context
.
lineTo
(
x2
,
y2
);
context
.
lineTo
(
x2
,
y2
);
context
.
stroke
();
context
.
stroke
();
};
};
morpheus
.
CanvasUtil
.
resetTransform
=
function
(
context
)
{
morpheus
.
CanvasUtil
.
resetTransform
=
function
(
context
)
{
context
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
context
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
if
(
morpheus
.
CanvasUtil
.
BACKING_SCALE
!==
1
)
{
if
(
morpheus
.
CanvasUtil
.
BACKING_SCALE
!==
1
)
{
context
.
scale
(
morpheus
.
CanvasUtil
.
BACKING_SCALE
,
context
.
scale
(
morpheus
.
CanvasUtil
.
BACKING_SCALE
,
morpheus
.
CanvasUtil
.
BACKING_SCALE
);
morpheus
.
CanvasUtil
.
BACKING_SCALE
);
}
}
};
};
morpheus
.
CanvasUtil
.
bezierCurveTo
=
function
(
context
,
start
,
end
)
{
morpheus
.
CanvasUtil
.
bezierCurveTo
=
function
(
context
,
start
,
end
)
{
var
m1
=
(
start
[
1
]
+
end
[
1
])
/
2
;
var
m1
=
(
start
[
1
]
+
end
[
1
])
/
2
;
context
.
beginPath
();
context
.
beginPath
();
context
.
moveTo
(
start
[
0
],
start
[
1
]);
context
.
moveTo
(
start
[
0
],
start
[
1
]);
...
@@ -146,24 +146,24 @@ morpheus.CanvasUtil.bezierCurveTo = function(context, start, end) {
...
@@ -146,24 +146,24 @@ morpheus.CanvasUtil.bezierCurveTo = function(context, start, end) {
context
.
bezierCurveTo
(
start
[
0
],
m1
,
end
[
0
],
m1
,
end
[
0
],
end
[
1
]);
context
.
bezierCurveTo
(
start
[
0
],
m1
,
end
[
0
],
m1
,
end
[
0
],
end
[
1
]);
context
.
stroke
();
context
.
stroke
();
};
};
morpheus
.
CanvasUtil
.
createCanvas
=
function
()
{
morpheus
.
CanvasUtil
.
createCanvas
=
function
()
{
var
$c
=
$
(
'
<canvas></canvas>
'
);
var
$c
=
$
(
'
<canvas></canvas>
'
);
$c
.
attr
(
'
tabindex
'
,
'
0
'
);
$c
.
attr
(
'
tabindex
'
,
'
0
'
);
$c
.
css
({
$c
.
css
({
cursor
:
'
default
'
,
cursor
:
'
default
'
,
outline
:
0
,
outline
:
0
,
overflow
:
'
hidden
'
,
overflow
:
'
hidden
'
,
position
:
'
absolute
'
,
position
:
'
absolute
'
,
'
z-index
'
:
1
'
z-index
'
:
1
});
});
return
$c
[
0
];
return
$c
[
0
];
};
};
morpheus
.
CanvasUtil
.
getHeaderStringWidth
=
function
(
context
,
s
)
{
morpheus
.
CanvasUtil
.
getHeaderStringWidth
=
function
(
context
,
s
)
{
context
.
font
=
'
14px
'
+
morpheus
.
CanvasUtil
.
FONT_NAME
;
context
.
font
=
'
14px
'
+
morpheus
.
CanvasUtil
.
FONT_NAME
;
return
context
.
measureText
(
s
).
width
+
18
;
return
context
.
measureText
(
s
).
width
+
18
;
};
};
morpheus
.
CanvasUtil
.
getVectorStringWidth
=
function
(
context
,
vector
,
positions
,
morpheus
.
CanvasUtil
.
getVectorStringWidth
=
function
(
context
,
vector
,
positions
,
end
)
{
end
)
{
if
(
positions
.
getSize
()
<
6
)
{
if
(
positions
.
getSize
()
<
6
)
{
return
0
;
return
0
;
}
}
...
@@ -177,7 +177,8 @@ morpheus.CanvasUtil.getVectorStringWidth = function(context, vector, positions,
...
@@ -177,7 +177,8 @@ morpheus.CanvasUtil.getVectorStringWidth = function(context, vector, positions,
var
toString
=
morpheus
.
VectorTrack
.
vectorToString
(
vector
);
var
toString
=
morpheus
.
VectorTrack
.
vectorToString
(
vector
);
var
maxWidth
=
0
;
var
maxWidth
=
0
;
// var maxWidth2 = 0;
// var maxWidth2 = 0;
for
(
var
i
=
0
,
n
=
end
<=
0
?
vector
.
size
()
:
Math
.
min
(
end
,
vector
.
size
());
i
<
n
;
i
++
)
{
var
n
=
end
<=
0
?
vector
.
size
()
:
Math
.
min
(
end
,
vector
.
size
());
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
value
=
vector
.
getValue
(
i
);
var
value
=
vector
.
getValue
(
i
);
if
(
value
!=
null
&&
value
!=
''
)
{
if
(
value
!=
null
&&
value
!=
''
)
{
value
=
toString
(
value
);
value
=
toString
(
value
);
...
@@ -194,7 +195,7 @@ morpheus.CanvasUtil.getVectorStringWidth = function(context, vector, positions,
...
@@ -194,7 +195,7 @@ morpheus.CanvasUtil.getVectorStringWidth = function(context, vector, positions,
}
}
return
maxWidth
>
0
?
(
maxWidth
+
2
)
:
maxWidth
;
return
maxWidth
>
0
?
(
maxWidth
+
2
)
:
maxWidth
;
};
};
morpheus
.
CanvasUtil
.
clipString
=
function
(
context
,
string
,
availTextWidth
)
{
morpheus
.
CanvasUtil
.
clipString
=
function
(
context
,
string
,
availTextWidth
)
{
var
textWidth
=
context
.
measureText
(
string
).
width
;
var
textWidth
=
context
.
measureText
(
string
).
width
;
if
(
textWidth
<=
availTextWidth
)
{
if
(
textWidth
<=
availTextWidth
)
{
return
string
;
return
string
;
...
@@ -215,32 +216,32 @@ morpheus.CanvasUtil.clipString = function(context, string, availTextWidth) {
...
@@ -215,32 +216,32 @@ morpheus.CanvasUtil.clipString = function(context, string, availTextWidth) {
}
}
return
string
+
clipString
;
return
string
+
clipString
;
};
};
morpheus
.
CanvasUtil
.
toSVG
=
function
(
drawable
,
file
)
{
morpheus
.
CanvasUtil
.
toSVG
=
function
(
drawable
,
file
)
{
var
totalSize
=
{
var
totalSize
=
{
width
:
drawable
.
getWidth
(),
width
:
drawable
.
getWidth
(),
height
:
drawable
.
getHeight
()
height
:
drawable
.
getHeight
()
};
};
var
context
=
new
C2S
(
totalSize
.
width
,
totalSize
.
height
);
var
context
=
new
C2S
(
totalSize
.
width
,
totalSize
.
height
);
context
.
save
();
context
.
save
();
drawable
.
draw
({
drawable
.
draw
({
x
:
0
,
x
:
0
,
y
:
0
,
y
:
0
,
width
:
totalSize
.
width
,
width
:
totalSize
.
width
,
height
:
totalSize
.
height
height
:
totalSize
.
height
},
context
);
},
context
);
context
.
restore
();
context
.
restore
();
var
svg
=
context
.
getSerializedSvg
();
var
svg
=
context
.
getSerializedSvg
();
var
blob
=
new
Blob
([
svg
],
{
var
blob
=
new
Blob
([
svg
],
{
type
:
'
text/plain;charset=utf-8
'
type
:
'
text/plain;charset=utf-8
'
});
});
saveAs
(
blob
,
file
);
saveAs
(
blob
,
file
);
};
};
morpheus
.
CanvasUtil
.
getMousePos
=
function
(
element
,
event
,
useDelta
)
{
morpheus
.
CanvasUtil
.
getMousePos
=
function
(
element
,
event
,
useDelta
)
{
return
morpheus
.
CanvasUtil
.
getMousePosWithScroll
(
element
,
event
,
0
,
0
,
return
morpheus
.
CanvasUtil
.
getMousePosWithScroll
(
element
,
event
,
0
,
0
,
useDelta
);
useDelta
);
};
};
morpheus
.
CanvasUtil
.
getClientXY
=
function
(
event
,
useDelta
)
{
morpheus
.
CanvasUtil
.
getClientXY
=
function
(
event
,
useDelta
)
{
var
clientX
;
var
clientX
;
var
clientY
;
var
clientY
;
if
(
event
.
pointers
)
{
if
(
event
.
pointers
)
{
...
@@ -256,21 +257,21 @@ morpheus.CanvasUtil.getClientXY = function(event, useDelta) {
...
@@ -256,21 +257,21 @@ morpheus.CanvasUtil.getClientXY = function(event, useDelta) {
clientY
=
event
.
clientY
;
clientY
=
event
.
clientY
;
}
}
return
{
return
{
x
:
clientX
,
x
:
clientX
,
y
:
clientY
y
:
clientY
};
};
};
};
morpheus
.
CanvasUtil
.
getMousePosWithScroll
=
function
(
element
,
event
,
scrollX
,
morpheus
.
CanvasUtil
.
getMousePosWithScroll
=
function
(
element
,
event
,
scrollX
,
scrollY
,
useDelta
)
{
scrollY
,
useDelta
)
{
return
morpheus
.
CanvasUtil
.
_getMousePosWithScroll
(
element
,
scrollX
,
return
morpheus
.
CanvasUtil
.
_getMousePosWithScroll
(
element
,
scrollX
,
scrollY
,
morpheus
.
CanvasUtil
.
getClientXY
(
event
,
useDelta
));
scrollY
,
morpheus
.
CanvasUtil
.
getClientXY
(
event
,
useDelta
));
};
};
morpheus
.
CanvasUtil
.
_getMousePosWithScroll
=
function
(
element
,
scrollX
,
morpheus
.
CanvasUtil
.
_getMousePosWithScroll
=
function
(
element
,
scrollX
,
scrollY
,
clientXY
)
{
scrollY
,
clientXY
)
{
var
rect
=
element
.
getBoundingClientRect
();
var
rect
=
element
.
getBoundingClientRect
();
return
{
return
{
x
:
clientXY
.
x
-
rect
.
left
+
scrollX
,
x
:
clientXY
.
x
-
rect
.
left
+
scrollX
,
y
:
clientXY
.
y
-
rect
.
top
+
scrollY
y
:
clientXY
.
y
-
rect
.
top
+
scrollY
};
};
};
};
src/ui/heat_map.js
View file @
a620bde9
...
@@ -3033,7 +3033,6 @@ morpheus.HeatMap.prototype = {
...
@@ -3033,7 +3033,6 @@ morpheus.HeatMap.prototype = {
var
totalSize
=
this
.
getTotalSize
(
options
);
var
totalSize
=
this
.
getTotalSize
(
options
);
var
legendHeight
=
0
;
var
legendHeight
=
0
;
if
(
options
.
legend
)
{
if
(
options
.
legend
)
{
context
.
save
();
context
.
save
();
context
.
translate
(
50
,
0
);
context
.
translate
(
50
,
0
);
morpheus
.
HeatMapColorSchemeLegend
.
drawColorScheme
(
context
,
morpheus
.
HeatMapColorSchemeLegend
.
drawColorScheme
(
context
,
...
@@ -3143,7 +3142,6 @@ morpheus.HeatMap.prototype = {
...
@@ -3143,7 +3142,6 @@ morpheus.HeatMap.prototype = {
width
:
heatmapPrefSize
.
width
,
width
:
heatmapPrefSize
.
width
,
height
:
track
.
getPrintSize
().
height
height
:
track
.
getPrintSize
().
height
};
};
track
.
print
(
trackClip
,
context
);
track
.
print
(
trackClip
,
context
);
context
.
restore
();
context
.
restore
();
// draw header
// draw header
...
@@ -3154,7 +3152,7 @@ morpheus.HeatMap.prototype = {
...
@@ -3154,7 +3152,7 @@ morpheus.HeatMap.prototype = {
x
:
0
,
x
:
0
,
y
:
0
,
y
:
0
,
width
:
headerSize
.
width
,
width
:
headerSize
.
width
,
height
:
headerSize
.
height
height
:
trackClip
.
height
};
};
context
.
translate
(
heatmapX
-
2
,
columnTrackY
+
trackClip
.
height
);
context
.
translate
(
heatmapX
-
2
,
columnTrackY
+
trackClip
.
height
);
header
.
print
(
headerClip
,
context
);
header
.
print
(
headerClip
,
context
);
...
...
src/ui/vector_track.js
View file @
a620bde9
...
@@ -258,7 +258,6 @@ morpheus.VectorTrack.prototype = {
...
@@ -258,7 +258,6 @@ morpheus.VectorTrack.prototype = {
if
(
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
BAR
))
{
if
(
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
BAR
))
{
width
+=
this
.
settings
.
barSize
;
width
+=
this
.
settings
.
barSize
;
}
}
if
(
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
COLOR
))
{
if
(
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
COLOR
))
{
width
+=
this
.
settings
.
colorBarSize
;
width
+=
this
.
settings
.
colorBarSize
;
}
}
...
@@ -271,7 +270,6 @@ morpheus.VectorTrack.prototype = {
...
@@ -271,7 +270,6 @@ morpheus.VectorTrack.prototype = {
if
(
!
forPrint
&&
!
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
MOLECULE
))
{
if
(
!
forPrint
&&
!
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
MOLECULE
))
{
width
=
Math
.
min
(
300
,
width
);
width
=
Math
.
min
(
300
,
width
);
}
}
if
(
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
ARC
))
{
if
(
this
.
isRenderAs
(
morpheus
.
VectorTrack
.
RENDER
.
ARC
))
{
width
+=
this
.
settings
.
arcSize
;
width
+=
this
.
settings
.
arcSize
;
}
}
...
...
src/ui/vector_track_header.js
View file @
a620bde9
...
@@ -310,10 +310,11 @@ morpheus.VectorTrackHeader.prototype = {
...
@@ -310,10 +310,11 @@ morpheus.VectorTrackHeader.prototype = {
var
context
=
this
.
canvas
.
getContext
(
'
2d
'
);
var
context
=
this
.
canvas
.
getContext
(
'
2d
'
);
context
.
font
=
this
.
defaultFontHeight
+
'
px
'
context
.
font
=
this
.
defaultFontHeight
+
'
px
'
+
morpheus
.
CanvasUtil
.
FONT_NAME
;
+
morpheus
.
CanvasUtil
.
FONT_NAME
;
var
w
idth
=
4
+
context
.
measureText
(
this
.
name
).
width
;
var
textW
idth
=
4
+
context
.
measureText
(
this
.
name
).
width
;
return
{
return
{
width
:
width
,
width
:
textWidth
,
height
:
this
.
getUnscaledHeight
()
height
:
this
.
defaultFontHeight
+
morpheus
.
VectorTrackHeader
.
FONT_OFFSET
};
};
},
},
getSortKeys
:
function
()
{
getSortKeys
:
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment