-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
2,579 additions
and
2,586 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
const { update, show } = require("./src/ui/main_panel_ui"); | ||
const { onTapGenerate } = require("./src/generate"); | ||
const { exportColor } = require("./src/color"); | ||
|
||
module.exports = { | ||
panels: { | ||
main_panel: { | ||
show, | ||
update | ||
} | ||
}, | ||
commands: { | ||
onTapGenerate: onTapGenerate, | ||
exportColor: exportColor | ||
} | ||
}; | ||
|
||
|
||
/* | ||
TODO: | ||
! Android Adaptive icon | ||
! Mask | ||
! Grid | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class Bounds { | ||
/** | ||
* @param {Node} node | ||
* @param {number} x1 | ||
* @param {number} x2 | ||
* @param {number} y1 | ||
* @param {number} y2 | ||
*/ | ||
constructor(node, parentBouds, x1, x2, y1, y2) { | ||
if (!node && !parentBouds) { | ||
this.x1 = x1 | ||
this.x2 = x2; | ||
this.y1 = y1; | ||
this.y2 = y2; | ||
} else if (!node) { | ||
this.x1 = parentBouds.x1 | ||
this.x2 = parentBouds.x2; | ||
this.y1 = parentBouds.y1; | ||
this.y2 = parentBouds.y2; | ||
} else { | ||
this.x1 = node.globalBounds.x; | ||
this.x2 = this.x1 + node.globalBounds.width; | ||
this.y1 = node.globalBounds.y; | ||
this.y2 = this.y1 + node.globalBounds.height; | ||
} | ||
} | ||
} | ||
|
||
exports.Bounds = Bounds; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
const { getColor } = require("./widgets/util/color"); | ||
const { exportDialog } = require("./ui/dialogs/dialogs"); | ||
|
||
let clipboard = require("clipboard"); | ||
let scenegraph = require("scenegraph") | ||
|
||
let withErro; | ||
let color; | ||
|
||
const keydownFunc = function (event) { | ||
try { | ||
const key = event.key; | ||
if (key == 1) { | ||
color = exportFill(); | ||
} else if (key == 2) { | ||
color = exportStroke(); | ||
} else if (key == 3) { | ||
color = exportShadow(); | ||
} else if (key == 'Escape') { | ||
} else { | ||
withErro = 'invalidKey'; | ||
} | ||
} catch (error) { | ||
withErro = true; | ||
} | ||
if (color) clipboard.copyText(color); | ||
return false; | ||
}; | ||
|
||
async function exportColor() { | ||
withErro = null; | ||
color = null; | ||
const node = scenegraph.selection.items[0]; | ||
if (node.children.length > 1 || scenegraph.selection.items.length > 1) { | ||
await exportDialog("Select only one item", 'Ok', 'Tap any key to close'); | ||
} else { | ||
document.addEventListener('keydown', keydownFunc); | ||
await exportDialog("Copy Item Color, Tap:", 'Cancelar', "1 to Fill<br>2 to Stroke<br>3 to Shadow"); | ||
document.removeEventListener('keydown', keydownFunc); | ||
if (withErro != null) { | ||
if (withErro == 'invalidKey') { | ||
await exportColor(); | ||
} else { | ||
await exportDialog("Error", 'Ok', 'Tap any key to close'); | ||
} | ||
} else { | ||
if (color != null) { | ||
await exportDialog("Success", 'Ok', 'Tap any key to close'); | ||
} | ||
} | ||
} | ||
} | ||
|
||
function exportFill() { | ||
const node = scenegraph.selection.items[0]; | ||
return getColor(node.fill); | ||
} | ||
|
||
function exportStroke() { | ||
const node = scenegraph.selection.items[0]; | ||
return getColor(node.stroke); | ||
} | ||
|
||
function exportShadow() { | ||
const node = scenegraph.selection.items[0]; | ||
return getColor(node.shadow.color); | ||
} | ||
|
||
module.exports = { | ||
exportColor: exportColor, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.