Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
4c50363a
Commit
4c50363a
authored
6 years ago
by
Karishma Chadha
Browse files
Options
Downloads
Patches
Plain Diff
Fixed svg thumbnails, some cleanup.
parent
f2b398ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/containers/costume-tab.jsx
+12
-7
12 additions, 7 deletions
src/containers/costume-tab.jsx
with
12 additions
and
7 deletions
src/containers/costume-tab.jsx
+
12
−
7
View file @
4c50363a
...
...
@@ -172,7 +172,6 @@ class CostumeTab extends React.Component {
const
thisFileInput
=
e
.
target
;
let
thisFile
=
null
;
const
reader
=
new
FileReader
();
const
thisThing
=
this
;
reader
.
onload
=
()
=>
{
// Reset the file input value now that we have everything we need
// so that the user can upload the same image multiple times
...
...
@@ -180,7 +179,7 @@ class CostumeTab extends React.Component {
thisFileInput
.
value
=
null
;
const
storage
=
this
Thing
.
props
.
vm
.
runtime
.
storage
;
const
storage
=
this
.
props
.
vm
.
runtime
.
storage
;
const
fileType
=
thisFile
.
type
;
// check what the browser thinks this is
// Only handling png and svg right now
let
costumeFormat
=
null
;
...
...
@@ -191,12 +190,13 @@ class CostumeTab extends React.Component {
}
else
if
(
fileType
===
'
image/jpeg
'
)
{
costumeFormat
=
storage
.
DataFormat
.
JPG
;
assetType
=
storage
.
AssetType
.
ImageBitmap
;
}
else
{
}
else
if
(
fileType
===
'
image/png
'
)
{
costumeFormat
=
storage
.
DataFormat
.
PNG
;
assetType
=
storage
.
AssetType
.
ImageBitmap
;
}
if
(
!
costumeFormat
)
return
;
const
addCostumeFromBuffer
=
function
(
error
,
costumeBuffer
)
{
const
addCostumeFromBuffer
=
(
function
(
error
,
costumeBuffer
)
{
if
(
error
)
{
log
.
warn
(
`An error occurred while trying to extract image data:
${
error
}
`
);
return
;
...
...
@@ -213,12 +213,17 @@ class CostumeTab extends React.Component {
md5
:
`
${
md5Ext
}
`
};
this
Thing
.
props
.
vm
.
addCostume
(
md5Ext
,
vmCostume
);
};
this
.
props
.
vm
.
addCostume
(
md5Ext
,
vmCostume
);
}
).
bind
(
this
)
;
if
(
costumeFormat
===
storage
.
DataFormat
.
SVG
)
{
addCostumeFromBuffer
(
null
,
reader
.
result
);
// Must pass in file data as a Uint8Array,
// passing in an array buffer causes the sprite/costume
// thumbnails to not display because the data URI for the costume
// is invalid
addCostumeFromBuffer
(
null
,
new
Uint8Array
(
reader
.
result
));
}
else
{
// otherwise it's a bitmap
importBitmap
(
reader
.
result
,
addCostumeFromBuffer
);
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment