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
ba277a52
Commit
ba277a52
authored
6 years ago
by
Paul Kaplan
Browse files
Options
Downloads
Patches
Plain Diff
Fix namer conventions to be less bizarre
parent
489467e6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/containers/target-pane.jsx
+2
-2
2 additions, 2 deletions
src/containers/target-pane.jsx
src/lib/file-uploader.js
+6
-6
6 additions, 6 deletions
src/lib/file-uploader.js
with
8 additions
and
8 deletions
src/containers/target-pane.jsx
+
2
−
2
View file @
ba277a52
...
...
@@ -136,9 +136,9 @@ class TargetPane extends React.Component {
handleSpriteUpload
(
e
)
{
const
storage
=
this
.
props
.
vm
.
runtime
.
storage
;
handleFileUpload
(
e
.
target
,
(
buffer
,
fileType
,
fileName
)
=>
{
const
pluralizeCostume
=
i
=>
this
.
props
.
intl
.
formatMessage
(
const
costumeSuffixer
=
i
=>
this
.
props
.
intl
.
formatMessage
(
sharedMessages
.
costume
,
{
index
:
i
});
spriteUpload
(
buffer
,
fileType
,
fileName
,
storage
,
this
.
handleNewSprite
,
pluralizeCostume
);
spriteUpload
(
buffer
,
fileType
,
fileName
,
storage
,
this
.
handleNewSprite
,
costumeSuffixer
);
});
}
setFileInput
(
input
)
{
...
...
This diff is collapsed.
Click to expand it.
src/lib/file-uploader.js
+
6
−
6
View file @
ba277a52
...
...
@@ -90,18 +90,18 @@ const createVMAsset = function (storage, fileName, assetType, dataFormat, data)
* @param {ArrayBuffer | string} fileData The costume data to load (this can be a base64 string
* iff the image is a bitmap)
* @param {string} fileType The MIME type of this file
* @param {string | Function} costumeName
OrName
r String or function producing the user-readable
* @param {string | Function} costumeNamer String or function producing the user-readable
* name to use for the costume. Function will be called with an index in case of gif upload.
* @param {ScratchStorage} storage The ScratchStorage instance to cache the costume data
* @param {Function} handleCostume The function to execute on the costume object returned after
* caching this costume in storage - This function should be responsible for
* adding the costume to the VM and handling other UI flow that should come after adding the costume
*/
const
costumeUpload
=
function
(
fileData
,
fileType
,
costumeName
OrName
r
,
storage
,
handleCostume
)
{
const
costumeUpload
=
function
(
fileData
,
fileType
,
costumeNamer
,
storage
,
handleCostume
)
{
let
costumeFormat
=
null
;
let
assetType
=
null
;
const
costumeN
amer
=
typeof
costumeName
OrName
r
===
'
string
'
?
(()
=>
costumeName
OrName
r
)
:
costumeName
OrName
r
;
const
n
amer
=
typeof
costumeNamer
===
'
string
'
?
(()
=>
costumeNamer
)
:
costumeNamer
;
switch
(
fileType
)
{
case
'
image/svg+xml
'
:
{
costumeFormat
=
storage
.
DataFormat
.
SVG
;
...
...
@@ -121,7 +121,7 @@ const costumeUpload = function (fileData, fileType, costumeNameOrNamer, storage,
case
'
image/gif
'
:
{
let
costumes
=
[];
const
onFrame
=
(
frameNumber
,
dataUrl
)
=>
{
costumeUpload
(
dataUrl
,
'
image/png
'
,
costumeN
amer
(
frameNumber
+
1
),
storage
,
costumes_
=>
{
costumeUpload
(
dataUrl
,
'
image/png
'
,
n
amer
(
frameNumber
+
1
),
storage
,
costumes_
=>
{
costumes
=
costumes
.
concat
(
costumes_
);
});
};
...
...
@@ -140,7 +140,7 @@ const costumeUpload = function (fileData, fileType, costumeNameOrNamer, storage,
const
addCostumeFromBuffer
=
function
(
dataBuffer
)
{
const
vmCostume
=
createVMAsset
(
storage
,
costumeN
amer
(
1
),
n
amer
(
1
),
assetType
,
costumeFormat
,
dataBuffer
...
...
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