1352 Commits

Author SHA1 Message Date
decd91dc75 release: bump to version 0.13.0 2017-10-22 00:41:49 +02:00
21cf0e072b release: bump version to 0.13.0-RC2 2017-10-22 00:38:29 +02:00
4875a94dae Remove html autocomplete fromt size input fields 2017-10-22 00:35:55 +02:00
a4fb0565d2 release: fix minor ui issues for checkbox containers 2017-10-22 00:32:17 +02:00
2e7eaec0e5 release: bump version to 0.13.0-RC1 2017-10-21 23:53:01 +02:00
5ecf351e0f Return promise results from PiskelDB and IndexedDBStorageService 2017-10-21 23:48:51 +02:00
407b432227 Show error message if BackupDatabase promise rejected 2017-10-21 23:48:51 +02:00
69cc27557e Add templates for backup database errors 2017-10-21 23:48:51 +02:00
cfd3773a2b Issue #751 - add repeat checkbox to GIF export panel 2017-10-08 19:46:43 +02:00
0eface45f1 Issue #750 - drawing tests: always initialize penSize before starting test 2017-10-08 19:12:04 +02:00
87893bb4ac Issue #750 - Fix mirror pen with even pensizes 2017-10-08 19:12:04 +02:00
77d26bffa9 Issue #727 - add integration test for simple import flow 2017-10-08 18:19:52 +02:00
652027bd3f Issue #727 - update integration tests to wait for color service update 2017-10-08 18:19:52 +02:00
bf4cc3302a Issue #727 - skip import steps if current piskel is empty 2017-10-08 18:19:52 +02:00
95c8df1224 Issue #727 - simplify import: resize and insertion steps 2017-10-08 18:19:52 +02:00
7445357368 Issue #727 - simplify import mode text 2017-10-08 18:19:52 +02:00
a2369cac0c Issue #727 - remove border around meta info in import wizard 2017-10-08 18:19:52 +02:00
51538dff48 Make piskel performance warning less scary 2017-09-24 18:06:37 +02:00
da739e78da Issue #743 - bump color palette cap to 256 2017-09-24 17:39:03 +02:00
dd8217e21b Issue #744 - show notification when exporting to GIF can not preserve colors 2017-09-24 17:37:49 +02:00
d502d3416b Issue #745 - Add https support 2017-09-24 17:37:14 +02:00
d1156954ca Issue #729 - implement custom PNG export viewer instead of opening window to data-uri 2017-09-24 17:36:02 +02:00
dc5209628c fix selectionmanager unit test 2017-09-06 23:05:17 +02:00
8568663949 Move clipboard events to dedicated service and fix tests 2017-09-06 23:05:17 +02:00
fd3d828067 remove unused selection copy cut paste events 2017-09-06 23:05:17 +02:00
e1797b2008 Fix SelectionManagerTest by using a clipboard event mock 2017-09-06 23:05:17 +02:00
0a43f6bbec Fix copy to website script to work if main-partial is missing. 2017-09-06 23:05:17 +02:00
b9423bc831 Issue #645: Support clipboard to paste images 2017-09-06 23:05:17 +02:00
5e6280301d Issue #736 - cleanup selection tool state on SELECTION_DISMISSED event 2017-09-06 00:39:35 +02:00
5671eb4782 Delete all extra backup sessions if MAX is reached 2017-08-06 22:56:43 +02:00
35788b54ba update travis yml to upgrade node and stop downloading casper 2017-08-03 00:44:53 +02:00
629ecf83b4 add comments for values synced between JS and CSS 2017-08-03 00:21:08 +02:00
c037b07693 rename mergeData to backupsData in browse backups wizard 2017-08-03 00:21:08 +02:00
c31b7a351c update piskel mock in BackupServiceTest 2017-08-03 00:21:08 +02:00
7de03f1e73 show snpashot previews in the browse backups dialog 2017-08-03 00:21:08 +02:00
eab21e0839 Show confirmation message when loading snapshot backup 2017-08-03 00:21:08 +02:00
2b3bd02479 improve styling of snapshot list in browse backups dialog 2017-08-03 00:21:08 +02:00
4e86fa1570 dev-environment: add ctrl+alt+R shortcut to reload styles 2017-08-03 00:21:08 +02:00
170a7e4731 skip backups for current session in browse backups dialog 2017-08-03 00:21:08 +02:00
6b7f04b63e browse backups dialog: add styling for empty session list 2017-08-03 00:21:08 +02:00
da2e9f99e4 cleanup: remove title on backup session element 2017-08-03 00:21:08 +02:00
530a949e54 add icon for backup dialog 2017-08-03 00:21:08 +02:00
4377c9e601 add disclaimer in the browse backups dialog 2017-08-03 00:21:08 +02:00
e0bbb88d47 confirm backup session delete, add animation 2017-08-03 00:21:08 +02:00
9ff2ecbb45 improve styling for browse-backups dialog 2017-08-03 00:21:08 +02:00
8beba2088b remove useless console.log 2017-08-03 00:21:08 +02:00
ee45cdcc45 add a browse backups dialog 2017-08-03 00:21:08 +02:00
30ea7fa079 fix migration script for localstorage to indexeddb 2017-08-03 00:21:08 +02:00
e9b39a5c61 add unit test for PiskelDatabase 2017-08-03 00:21:08 +02:00
d0a32b18c5 add unit test for backup database 2017-08-03 00:21:08 +02:00
372ad1f513 add unit test for BackupService 2017-08-03 00:21:08 +02:00
c6e106fe2d add a limit to the number of sessions backed up 2017-08-03 00:21:08 +02:00
f9570ea3c5 Issue #640 - extract database code to dedicated package 2017-08-03 00:21:08 +02:00
f9cb631acb Issue #640 - migrate backup service to indexeddb 2017-08-03 00:21:08 +02:00
ed749a747f Issue #640 - migrate local browser save to indexeddb 2017-08-03 00:21:08 +02:00
30ecd41452 Issue #640 - remove duplicated entries in piskel-script-list 2017-08-03 00:21:08 +02:00
af65344c23 Issue #640 - rename PaletteService pointer to localStorage to localStorageGlobal
PaletteService exposes window.localStorage as this.localStorageService. This is confusing since we also have the LocalStorageService class used to save piskels in local storage.
2017-08-03 00:21:08 +02:00
183133496e Fix #718 - when dropping image, only use import wizard for big images 2017-08-01 01:06:09 +02:00
8a2c0191f9 release: bump version to 0.12.1 2017-07-18 08:06:54 +02:00
a096dcabfd Fix #717: filter invalid colors 2017-07-18 08:05:48 +02:00
96d326ef12 release: bump version to 0.13.0-SNAPSHOT 2017-06-23 21:01:47 +02:00
7c37372b13 release: bump version to v0.12.0 2017-06-23 21:01:47 +02:00
b21ea30fa8 Issue #658 - Support shift+UP/RIGHT/DOWN/LEFT to move the viewport 2017-06-10 23:12:11 +02:00
c2dbddcf9f Issue #636 - rename all application-settings things to preferences-settings
The name is not ideal, but it's better to have a MiscPreferencesController than a MainApplicationController for this kind of very simple panels.
2017-06-10 11:20:23 +02:00
09ce6ff88f Issue #636 - remove unused code 2017-06-10 11:20:23 +02:00
2c4a8efb44 Issue #636 - add integration test for main settings panel 2017-06-10 11:20:23 +02:00
02a25d3f84 Fix eslint violations 2017-06-10 11:20:23 +02:00
d159de2e65 Update gitignore for vscode 2017-06-10 11:20:23 +02:00
726a8f74c1 Switch from jscs+jshint to eslint 2017-06-10 11:20:23 +02:00
89a65ab032 add test-export-gif-scale test to integration test suite 2017-06-10 11:20:23 +02:00
d8ec58b42c Remove reference to seamless in tooltip 2017-06-10 11:20:23 +02:00
1168870ee0 Issue #636 - Allow users to change the grid color 2017-06-10 11:20:23 +02:00
d3a37c74e9 Issue #636 - rename seamless* to tile* 2017-06-10 11:20:23 +02:00
5d2ca7e70c Issue #636 - create sizepicker widget and use it in grid settings 2017-06-10 11:20:23 +02:00
2976fd09ea Issue #636 - create Tabs widget and use it application settings panel 2017-06-10 11:20:23 +02:00
317fda83c3 add integration test for tiny-palettes 2017-06-04 22:29:54 +02:00
94160d8fc4 Transform palette color title to uppercase 2017-06-04 22:29:54 +02:00
b977a146e9 Issue #663 - display 10 colors per row in palette for palettes with > 10 colors 2017-06-04 22:29:54 +02:00
aea4e4d6a6 Fix #704 - increase height of offline apps window to 700px 2017-06-03 10:23:40 +02:00
5456ea973a Fix #690 - remove references to github/juliandescottes in README 2017-06-03 09:38:23 +02:00
a299d9aed0 Fix #697 - update confirmation message when closing Piskel with unsaved changes 2017-06-03 00:49:52 +02:00
cc2fc48107 Fix #271: add new piskel button for desktop application 2017-06-03 00:15:08 +02:00
799c9fbf5a Feature #541 crop based on the current selection 2017-06-01 19:46:34 +02:00
a9e22535d6 feature #541: add crop transform tool 2017-06-01 19:46:34 +02:00
4b4cbe47c8 support expanding the transform toolbox 2017-06-01 19:46:34 +02:00
e7d07c5353 Fix #699 - add SPACE to keycode translator 2017-05-27 09:05:05 +02:00
cf3383722a check meta key when recording drawing test (OSX) 2017-05-20 20:03:42 +02:00
6566ca07a5 add new layer just before the current layer 2017-05-20 20:03:42 +02:00
9fafa8b7a7 use SHIFT meta when clicking up down layer to move to top/bottom 2017-05-20 20:03:42 +02:00
4a9f7cc74b add grunt task to run drawing tests 2017-05-20 20:03:42 +02:00
319060beb6 add drawing test for move layer top/bottom 2017-05-20 20:03:42 +02:00
729c9f4732 Updating README.md to resolve license dating
Changed 2016 to 2017 to resolve any license dating issues.
2017-05-20 19:53:55 +02:00
cd560012e1 Adds comments to Stroke tool for drawing lines. 2017-05-17 23:57:30 +02:00
e819503cc5 Adjusts lineTool ends to square shape. 2017-05-17 23:57:30 +02:00
6512c3dcc0 Improves performance of line tool for large pen sizes. 2017-05-17 23:57:30 +02:00
3535dfb25e replace references to github.com/juliandescottes for github.com/piskelapp 2017-05-14 19:18:19 +02:00
a69554f6c9 release: bump version to 0.12.0-SNAPSHOT 2017-05-14 19:16:58 +02:00
1040cb4d8c release: bump version to 0.11.1 2017-05-14 19:04:33 +02:00
d18b85df16 Fix template bug for IE11 2017-05-14 18:55:51 +02:00
76563bfc41 release: bump version to v0.12.0-SNAPSHOT 2017-05-14 17:43:35 +02:00
2ba95667b2 release: bump version to v0.11.0 2017-05-14 17:39:33 +02:00
3949051ba7 release: add release script to run grunt+copy to piskel-website 2017-05-14 17:39:33 +02:00
df6780a3e7 store version in window.pskl and display it in settings 2017-05-14 17:39:33 +02:00
b768a22b1c Fix #689 - add unit test for v1 deserializer 2017-05-14 17:39:33 +02:00
8f4f9d9b0a Fix #689 - add unit test for v0 deserializer 2017-05-14 17:39:33 +02:00
14e969a3bb Fix typos and errors in existing DeserializationTest 2017-05-14 17:39:33 +02:00
0ef69bae58 Fix #689 - Constants.DEFAULTS->DEFAULT in deserializers v0/v1 2017-05-14 17:39:33 +02:00
b40c1c4744 reduce button size 2017-05-13 01:36:04 +02:00
261259b38f remove unused styles from dialogs-import.css 2017-05-13 01:36:04 +02:00
799bf76a86 update integration tests after selectMode step changes 2017-05-13 01:36:04 +02:00
42f329980c remove cancel button from import steps, add big select mode buttons 2017-05-13 01:36:04 +02:00
80a1edf027 add unit test for piskel MergeUtils 2017-05-13 01:36:04 +02:00
92934502e8 fix merge of smaller piskel into bigger piskel 2017-05-13 01:36:04 +02:00
4d07a4eb90 select the first imported layer after a merge 2017-05-13 01:36:04 +02:00
41ef0cd460 increase casper load timeout 2017-05-13 01:36:04 +02:00
d77889d265 add integration test chaining two import flows 2017-05-13 01:36:04 +02:00
4f15b14b58 IE11 fixes 2017-05-13 01:36:04 +02:00
00d4a1614b protect frame-picker destroy if frame picker init() was not called 2017-05-13 01:36:04 +02:00
a72b0c69e5 initialize insert-location frame-picker on show() 2017-05-13 01:36:04 +02:00
c6733cdad4 add integration test for import merge wizard 2017-05-13 01:36:04 +02:00
30274ad1f8 replace Promise by Q.defer in ImageImport step 2017-05-13 01:36:04 +02:00
b7fe8c1a5e use image name as piskel name for image import 2017-05-13 01:36:04 +02:00
a68dccfce0 persist preview UI during import wizard 2017-05-13 01:36:04 +02:00
78bbc71e6c Implement Import and Merge wizard dialog 2017-05-13 01:36:04 +02:00
b5a8eb9f96 Feature #683 - add drawing test for duplicate layer 2017-05-13 01:11:45 +02:00
af3d0fa48b Feature #683: duplicate layer when SHIFT+CLICK on create layer button 2017-05-13 01:11:45 +02:00
e6a65c0db4 Fix #687 - use normal flavor for nwjs apps 2017-05-13 01:03:14 +02:00
f2b733c91e Fix #684 - import GIF as spritesheet failed 2017-05-11 01:47:15 +02:00
4506fdbdf2 add new grunt target to build desktop apps for older osx 2017-05-09 09:45:08 +02:00
5d6f354443 Fix #652 - fix worker ObjectURL creation 2017-05-08 01:17:29 +02:00
a6d3aff9f1 releae: update version to 0.11.0-SNAPSHOT 2017-05-08 00:17:00 +02:00
a707170fa2 release: update version to v0.10.1 2017-05-08 00:06:14 +02:00
8c815f320d copy version file to piskel website 2017-05-08 00:06:14 +02:00
f74b081fad avoid sanitization for cheatsheet keys 2017-05-08 00:06:14 +02:00
b8fed60fa6 Fix #651 - stop drawing the zoomedout background if unnecessary 2017-05-06 18:47:01 +02:00
d841ad10f6 Merge pull request #677 from juliandescottes/dependencies
Dependencies
2017-05-06 18:42:55 +02:00
f6e16e7b4b chore: update grunt-spritesmith to 6.4.0 2017-05-06 18:31:49 +02:00
6fb8a6859c chore: update karma-phantomjs-launcher to 1.0.4 2017-05-06 18:30:08 +02:00
866553b2ca chore: update grunt-contrib-clean & grunt-contrib-uglify 2017-05-06 17:45:42 +02:00
5aad87471e chore: update jasmine-chore to 2.6.1 2017-05-06 17:42:19 +02:00
942aacbb94 chore: update fs-extra to 3.0.1 2017-05-06 17:35:40 +02:00
88da91bde3 chore: remove karma-chrome-launcher (unused) 2017-05-06 17:32:07 +02:00
ce94dbeeeb chore: update karma to 1.7.0 2017-05-06 16:54:11 +02:00
a8c85b8a29 Issue #654 : stop using jquery to create the FramesList markup 2017-04-01 12:48:11 +02:00
89199f2d6a Merge pull request #644 from juliandescottes/alt-to-pick-color
select color using alt+click (fixes #623)
2017-03-02 01:52:04 +01:00
98768b2e5b select color using alt+click (fixes #623) 2017-03-02 01:39:28 +01:00
62b1b8baf0 Merge pull request #642 from juliandescottes/sanitize-strings
sanitize strings coming from user inputs
2017-02-23 21:01:05 +01:00
11a063de12 sanitize strings coming from user inputs 2017-02-23 19:37:29 +01:00
6f4413f353 Merge pull request #638 from juliandescottes/nw-warning
add confirmation message when closing desktop app with unsaved changes
2017-02-19 15:14:33 +01:00
974450837e add confirmation message when closing desktop app with unsaved changes 2017-02-19 13:19:09 +01:00
c6c64af2fd Use Q deferred instead of native promise (IE11) 2017-02-11 16:57:56 +01:00
c68b82339c remove classList toggle with 2nd argument for IE11 2017-02-11 16:51:27 +01:00
099ff80155 Merge pull request #634 from zoeesilcock/628-fix-arrows-in-cheatsheet
Use standard HTML entities for the arrows displayed on the keyboard shortcut list
2017-02-05 12:41:30 +01:00
f30e16386d Use standard HTML entities for the arrows displayed on the keyboard shortcut list 2017-02-05 11:47:45 +01:00
08b97cb6f0 select previous layer after deleting layer 2017-02-04 14:32:23 +01:00
b6fa769ba1 temporary fix for layerlist scroll 2017-02-04 14:09:27 +01:00
47b09b10c5 Merge branch 'master' of https://github.com/juliandescottes/piskel 2017-02-04 13:49:20 +01:00
f039a89572 disable layerlist smoothscrolling 2017-02-04 13:43:49 +01:00
e74329f04e Merge pull request #629 from GMartigny/master
Add CodeClimate
2017-02-02 19:30:40 +01:00
8959b201e9 Excludes lib from linting 2017-02-01 16:17:38 +01:00
f5491dc557 Irregular whitespace 2017-02-01 16:15:02 +01:00
9ce3d44cc6 Add config file for CodeClimate 2017-02-01 15:51:13 +01:00
8928f3e626 Release version 0.10.0 2017-01-29 14:25:44 +01:00
e04fde7084 log errors when Deserialize fails 2017-01-29 14:18:59 +01:00
a25648f8e2 bump version to 0.10.0-RC2 2017-01-29 14:05:11 +01:00
1918227c81 add integration tests for PNG export & scaled export 2017-01-29 13:56:06 +01:00
8b1b21368c add gif export integration test 2017-01-29 02:42:42 +01:00
d781df3290 add drawing test for center tool 2017-01-29 00:11:58 +01:00
35bfcb5f00 Refines Circle tool for PenSize = 1 2017-01-28 02:27:50 +01:00
cce4cde98b Corrects Circle tool for even dimensions. 2017-01-28 02:27:50 +01:00
4706587abb Rewrites Circle drawing tool to behave better with large pen sizes. 2017-01-28 02:27:50 +01:00
c0182952c9 Merge pull request #622 from juliandescottes/fix-current-colors
Fix current colors
2017-01-25 15:08:30 +01:00
ba779a97a6 fix #621 : allow color worker to detect up to 256 colors 2017-01-25 15:07:55 +01:00
dc149f88d6 remove extra caching from CurrentColorsService 2017-01-25 14:59:09 +01:00
ac08ff8b82 Merge pull request #620 from zoeesilcock/285-import-multiple-frames
Allow adding multiple frames with drag and drop
2017-01-24 00:11:39 +01:00
9be332fad3 Allow adding multiple frames with drag and drop
This is a partial solution issue number #285. When dropping multiple images it creates a new frame for each one. It works great when all images are the same size and within the size of the piskel document. When the images aren't the size of the document they are positioned in the same way as single image import.
2017-01-22 11:16:18 +01:00
11db5ca45c remove getBoundRectanglePixels from PixelUtils 2017-01-21 18:24:48 +01:00
37445202f3 Merge pull request #618 from smiegrin/rectanlgeRetool
Improves Rectangle tool performance.
2017-01-21 18:19:56 +01:00
f8b77403cd Improves Rectangle tool performance. 2017-01-16 11:52:22 -07:00
74d8aa8c9c migrate copy script to node 2017-01-15 14:13:05 +01:00
acad4df49e fix typos in perf warning popup 2017-01-15 13:33:57 +01:00
af92ee6bd7 increase height of performance info popup 2017-01-15 13:26:48 +01:00
a740699775 increase appengine storage limit to avoid false positive 2017-01-15 13:08:41 +01:00
6ce2c00acf force color black on brush size label 2017-01-15 13:00:15 +01:00
93db679dd7 release: bump version to 0.10.0-RC1 2017-01-15 12:51:10 +01:00
5bde3c471d remove unused paletteController member from DrawingController 2017-01-15 12:35:38 +01:00
94b1a1df4a History service gets core piskelController from public piskelController 2017-01-14 21:58:37 +01:00
8806c41892 Merge pull request #615 from juliandescottes/load-error-msg
display error message on file load error
2017-01-14 21:53:52 +01:00
8cad3bb607 display error message on file load error 2017-01-14 21:37:52 +01:00
552d4fa710 nits on test/js/utils/PixelUtilsTest_visit_connected.js 2017-01-14 15:44:47 +01:00
b11f7a430d add unit test for getSimilarConnectedPixelsFromFrame 2017-01-14 00:56:24 +01:00
a4952d0db2 fix #603 shape select fails when clicking outside drawing area 2017-01-13 15:07:05 +01:00
42f4812b46 move drop image logic to FrameUtils, add unit test 2017-01-13 13:58:57 +01:00
bf91c4ef62 Fix image dropper when image has to be moved 2017-01-13 13:22:21 +01:00
03f37d46ac add unit tests for colorToInt 2017-01-13 03:31:02 +01:00
0abd779348 fix #602 : shape selection fails with some colors 2017-01-13 02:59:59 +01:00
33259e5522 nits on previewSize widget 2017-01-11 23:43:57 +01:00
e8207aba57 update labels for preview size widget 2017-01-11 21:59:37 +01:00
b03b4a7c60 Merge pull request #567 from GMartigny/362-MultiSizePreview
Add a dropdown for preview size options [1x, best, full]
2017-01-11 21:56:23 +01:00
2f47bc433c lint fix 2017-01-11 12:32:29 +01:00
9cd3fa03a0 Merge branch 'master' into 362-MultiSizePreview 2017-01-11 12:28:20 +01:00
d4b4192d45 Final : Specific tooltip while preview size selection disabled 2017-01-11 12:23:49 +01:00
d5199d38aa remove css variables from built css (edge :( ) 2017-01-11 01:13:56 +01:00
ab082b9f4a set nwjs downloadURL to https 2017-01-09 09:27:49 +01:00
2ec6c4b848 upgrade nwjs to 0.19.4 2017-01-09 09:19:12 +01:00
2cdc999875 Fix bug when opening save panel for sprite with performance problem 2017-01-09 09:10:20 +01:00
4c6d2c1e48 Merge pull request #607 from juliandescottes/controller-tests
Add first integration tests
2017-01-09 00:43:46 +01:00
95256071e1 add missing EOF new lines 2017-01-08 20:43:15 +01:00
b86ec72a4e use evalLine in integration/settings/test-resize 2017-01-08 20:42:00 +01:00
70085bc056 Add integration tests for resize content and resize from other origin 2017-01-08 20:38:12 +01:00
a328e4d20e add resize test checking frame content
Moved shared methods to a head.js file
2017-01-08 19:56:53 +01:00
569b508fd5 mutualize casperjsOptions in gruntfile 2017-01-08 16:39:55 +01:00
d30f6a05d1 add integration tests 2017-01-08 16:09:03 +01:00
76ae797a9e nits: typos and case 2017-01-08 11:55:09 +01:00
61c76f980a Merge pull request #605 from Sal0hcine/fix-reset-default-colours
Pressing "d" for default colors doesn't fully work. #601
2017-01-05 11:44:49 +01:00
5bd113b38f Removed reset from SelectedColorsService and implemented the reset in PaletteController 2017-01-04 18:28:58 +00:00
aa5d4d4090 Merge branch 'master' of https://github.com/juliandescottes/piskel 2017-01-02 23:35:07 +01:00
398d93557a remove unused argument in FileDropperService constructor 2017-01-02 23:34:54 +01:00
0733a5a142 Merge pull request #600 from zoeesilcock/363-firefox-dnd-bug
Workaround for incorrect frame selection after re-ordering on Firefox
2017-01-02 23:27:33 +01:00
835cee37aa Merge pull request #599 from zoeesilcock/563-color-format-preference
Add a setting for changing the color format shown in the color picker
2017-01-02 23:09:19 +01:00
2dea7faea0 Workaround for incorrect frame selection after re-ordering on Firefox
This commit is related to the following issue: #363

When a frame is dropped both `mouseup` and `click` events are triggered on Firefox. This is somwhat expected behaviour but other browsers do not trigger the `click` event.

One would expect jquery-ui to work the same across all browsers but when they got a bug report they decided to not change anything:
https://bugzilla.mozilla.org/show_bug.cgi?id=787944

The most comon workaround appears to be to use the `clone` helper in jquery-ui sortable. Unfortunately this doesn't work because the cloned frame doesn't keep the contents of the canvas. This seemed like the cleanest workaround, here are a few others:
http://stackoverflow.com/questions/947195/jquery-ui-sortable-how-can-i-cancel-the-click-event-on-an-item-thats-dragged
2016-12-29 10:09:05 +01:00
809737908c Add a setting for changing the color format shown in the color picker 2016-12-29 08:08:13 +01:00
e43cee3c94 Merge pull request #598 from juliandescottes/disable-gallery
Disable gallery
2016-12-27 01:04:25 +01:00
b869d63211 remove useless comment 2016-12-27 00:56:18 +01:00
c0f7e7be52 jshint cleanup, move HTML to a template, add css classes 2016-12-27 00:56:18 +01:00
98527c6ded update notification style to use piskel theme colors 2016-12-27 00:56:17 +01:00
9518d570e6 display save to gallery warning if performance issue detected 2016-12-27 00:52:32 +01:00
01b9898181 improve serialization error detection for firefox 2016-12-27 00:52:32 +01:00
184b2e48aa disable gallery save when if spritesheet size too big (WIP) 2016-12-27 00:52:32 +01:00
e97a641e95 add constant for the max datastore accepted size 2016-12-27 00:52:32 +01:00
7eea5d672a fix hover image for minimap popup preview 2016-12-25 10:20:57 +01:00
537234b1d1 update minimap crop style 2016-12-24 11:09:12 +01:00
57936d90b1 fix jshint issue 2016-12-24 10:26:40 +01:00
ef8060c07d remove unused resizeNearestNeighbor util 2016-12-24 10:24:23 +01:00
8551a8546a fix #369 improve perf of grid rendering 2016-12-23 23:41:41 +01:00
eb84e87a13 add gold border on textfield:focus 2016-12-23 21:09:05 +01:00
ca3b789747 add user setting for seamless mode opacity 2016-12-22 23:27:00 +01:00
22dd474799 add border radius to settings export tabs 2016-12-22 22:33:04 +01:00
16151e8e95 remove text-shadow from settings panels 2016-12-22 22:21:32 +01:00
2f62be4927 simplify buttons styling 2016-12-22 14:21:21 +01:00
fbaccb03f2 introduce css variables 2016-12-22 13:06:01 +01:00
dd9b1e0189 add test to check deserialized piskel contains valid frames 2016-12-21 17:20:54 +01:00
dda566a218 fix broken serializer 2016-12-21 17:20:54 +01:00
2bcd354342 Merge pull request #595 from juliandescottes/unsupported-browser-popup
add a warning popup when detecting an unsupported browser
2016-12-21 15:52:45 +01:00
6cc41ee07b add a warning popup when detecting an unsupported browser 2016-12-21 15:44:04 +01:00
eca9191f29 increase drawing test timeout to 30 seconds 2016-12-21 15:38:31 +01:00
83c7e950f0 Merge pull request #593 from juliandescottes/save-split
Save split
2016-12-21 12:25:54 +01:00
32070efcc1 save split: add comments and cleanup 2016-12-21 12:22:50 +01:00
c743334a31 Switch back to line layout 2016-12-21 11:45:34 +01:00
84419a1550 split saved piskel in chunks when serialization fails 2016-12-21 02:28:11 +01:00
66c941dd25 support chunked layerData in regular deserializer 2016-12-18 11:36:11 +01:00
dba62d2b0d add pskl.utils.Array.chunk 2016-12-18 09:16:52 +01:00
156161f7c8 Merge pull request #574 from juliandescottes/warning-notifications
Warning notifications
2016-12-18 07:15:03 +01:00
58bfe16b27 performance warning: text cleanup 2016-12-18 06:52:44 +01:00
57b37971f6 add svg warning icon 2016-12-17 10:19:17 +01:00
8dab74ceea add text to warning notifications popup 2016-12-16 10:04:36 +01:00
d0cca52f47 issue #555: add performance warning icon, show dialog 2016-12-16 07:49:15 +01:00
58cf9f8390 issue #555 detect performance issues based on sprite specs 2016-12-16 07:49:15 +01:00
49109e51c9 fix js error when resizing piskel (missing fps arg) 2016-12-16 07:02:31 +01:00
27b26fe4f3 Merge pull request #589 from juliandescottes/move-fps-to-model
move fps info from preview controller to piskel model
2016-12-13 00:11:47 -10:00
b21fc0490d remove unused previewController member in ImportService 2016-12-13 11:04:03 +01:00
25ede9ffff cleanup unused arguments in PiskelFileUtils 2016-12-13 11:00:58 +01:00
37d2861352 move fps info from preview controller to piskel model 2016-12-13 09:17:34 +01:00
2fe0b842a5 update pixijs export metadata app url 2016-12-13 07:28:55 +01:00
dd7ab574b9 Merge pull request #581 from PSeitz/savejson
add pixi export
2016-12-12 20:23:45 -10:00
c2fdb65e37 simplify error template 2016-12-12 10:08:37 +01:00
aef88c8713 simplify error template 2016-12-12 09:58:56 +01:00
b3c13f1630 Merge pull request #587 from juliandescottes/create-issue-template
add issue template
2016-12-11 22:42:46 -10:00
6b0eda2998 add issue template 2016-12-12 09:35:02 +01:00
16cfffa898 Merge pull request #579 from PSeitz/piskelcopy
Copy between piskels
2016-12-09 07:18:45 -10:00
732c3c2d76 Merge pull request #577 from GMartigny/559-TooLongLayerName
Add ellipsis to overflowing layer item name #559
2016-12-06 03:19:48 +01:00
21c7425cbc add pixi export 2016-12-05 19:11:01 +01:00
9ac9583455 Address comment and nit 2016-12-05 09:43:15 +01:00
9608995d9c Fix spaces 2016-12-04 11:59:07 +01:00
5faa985dea Copy between piskels
#272
2016-12-04 11:40:18 +01:00
5544f734cf 🥷 2016-12-02 17:30:38 +01:00
9d0d38e081 Proposal : tooltip only when layer name overflow 2016-12-02 17:21:10 +01:00
ad5c8182e4 Add ellipsis to overflowing layer item name #559 2016-12-01 11:43:23 +01:00
9dd403a54e Merge pull request #560 from smiegrin/master
Allows square brush size of up to 32 pixels using keyboard...
2016-11-30 23:05:03 +01:00
f2424ed16e Resolve options collision
Disable preview widget with tooltip
Fix animation with shortcuts
2016-11-30 11:25:47 +01:00
da0e8dec84 Stylistic changes to pixel and pen size code. 2016-11-28 08:21:30 -07:00
a5fc491e92 Merge pull request #573 from juliandescottes/update-deps
Update deps
2016-11-27 23:43:23 +01:00
e53ee0604c chore: update dateformat to 2.0.0 2016-11-27 12:08:51 +01:00
e1671202af chore: update grunt-contrib-jshint to 1.1.0 2016-11-27 12:08:18 +01:00
5e3bb9d79c chore: update nwjs to 0.18.8 2016-11-27 12:07:25 +01:00
c5c336e12c chore: update grunt-nw-builder to 3.1.0 2016-11-27 11:57:13 +01:00
85b141df52 chore: udpate karma to 1.3.0 2016-11-27 11:54:27 +01:00
a65eeee2e0 Merge branch 'master' of https://github.com/juliandescottes/piskel 2016-11-26 13:32:23 -07:00
39dba2b70f Displays pen size in selector for sizes above 4 pixels wide. 2016-11-26 13:09:07 -07:00
0cb4a7831b fix drawing tests when running in browser 2016-11-24 14:18:52 +01:00
696d18748a Move tooltips
Change "best" option on resize
Update available options on resize and configuration change
2016-11-23 18:32:17 +01:00
e328b4c7b8 Add a dropdown for preview size options [1x, best, full]
https://github.com/juliandescottes/piskel/issues/362
2016-11-22 17:12:15 +01:00
5996216ae7 Merge pull request #566 from juliandescottes/memory-improvements
Memory improvements
2016-11-22 00:27:33 +01:00
8cb7a4aaf6 Permits brush size of only 1-32 pixels. 2016-11-21 12:53:14 -07:00
136506da40 issue #374 throttle calls to currentColorsService update function 2016-11-20 12:08:31 +01:00
d08c101b11 issue #374 cap cached frames for cachedframeprocessor to 100 2016-11-20 01:10:05 +01:00
4b50dfdb5b issue #374 limit undo/redo to the last 500 states 2016-11-20 00:24:48 +01:00
e3b363d757 Fix regression when loading piskel files 2016-11-12 18:33:00 +01:00
440c28d0fd Fix regression when loading piskel files 2016-11-12 18:32:21 +01:00
a560872df7 Stylistic changes to src/js/utils/PixelUtils.js 2016-10-28 18:39:00 -06:00
aca6c28b4b Allows square brush size of up to 1,000,000 pixels using keyboard shortcuts. 2016-10-28 17:56:22 -06:00
4a01f5625c release: set version to v0.9.0-RC2 2016-10-16 21:32:00 +02:00
8f493a8147 add comment in arraybuffer serialization helpers 2016-10-16 18:33:10 +02:00
73986c4e61 move arraybuffer serializer to dedicated subfolder 2016-10-16 18:28:12 +02:00
2a7957bce2 rollback to modelv2 for all serializations except history service 2016-10-16 00:22:06 +02:00
0586756b92 release: set version to 0.9.0-RC1 2016-10-15 19:30:53 +02:00
2b78456314 fix #554: zooming in/out breaks drawing area on Safari 2016-10-10 18:14:06 +02:00
4b378d48a2 trigger piskel_saved event after loading page sprite 2016-10-10 03:03:59 +02:00
5faf4af7c9 fix page title update when loading existing piskel 2016-10-10 02:44:51 +02:00
d947fe1c05 add blob type 2016-10-10 02:17:19 +02:00
85336f9b9a fix loading of v2 models 2016-10-10 01:47:26 +02:00
91f637d2fd fix color picker regression with intToColor missing 2016-10-09 23:59:16 +02:00
eb69c91d43 add other color picker test 2016-10-09 23:59:16 +02:00
7ae40d8794 fix pick color with middle mouse no longer workin 2016-10-09 23:59:16 +02:00
5a39d6850e fix backward compatibility issue on piskelapp.com 2016-10-09 23:59:16 +02:00
f342b72e1b Merge pull request #553 from juliandescottes/fix-transparency-glitch
Fix transparency issues after deserialization
2016-10-09 13:25:49 +02:00
1624792f61 Fix transparency issues after deserialization 2016-10-09 13:09:28 +02:00
dd58af30b9 close dialogs when clicking outside of the dialog container 2016-10-02 00:56:13 +02:00
4e515f4820 use monospace instead of Courier 2016-10-02 00:49:49 +02:00
71ec809aea fix #502: add smoothscroll polyfill 2016-10-02 00:23:26 +02:00
9538e03928 Fix BackupService change JSON to new serialization 2016-10-01 14:34:01 +02:00
e647826095 Move string to buffer converting code to utils 2016-10-01 14:34:01 +02:00
5fe9081df1 Remove unneccessary frame version incrementing 2016-10-01 14:34:01 +02:00
d4f038f97b Move buffer to string converting to utils 2016-10-01 14:34:01 +02:00
23a0768f8d Fix wrong calculation of requried bytes 2016-10-01 14:34:01 +02:00
4cc434edd6 Remove atob and btoa, it's already in base64 2016-10-01 14:34:01 +02:00
26b3cf3a23 Remove unnecessary caching 2016-10-01 14:34:01 +02:00
7e9c632efd Remove unused sub variable 2016-10-01 14:34:01 +02:00
6c50816830 Refactor downloadAsFile to accept blob 2016-10-01 14:34:01 +02:00
38cbfe4fce Fix FileDropperService to work with the new cb 2016-10-01 14:34:01 +02:00
d775609183 Remove unneccessary frame version incrementation 2016-10-01 14:34:01 +02:00
74f36daa7c Break oneliner to multiple lines 2016-10-01 14:34:01 +02:00
ffca6aa44c Move intToHex to utils and change for to map 2016-10-01 14:34:01 +02:00
6ea9c248d8 Remove unneccessary else if 2016-10-01 14:34:01 +02:00
9c96c7eaf2 Fix missing variable and remove unnecessesary if 2016-10-01 14:34:01 +02:00
c97ce34e6e Fix consistency 2016-10-01 14:34:01 +02:00
43f989919c Remove unneccessary type check 2016-10-01 14:34:01 +02:00
0ec8036670 Move Uint32Array.fill polyfill to utils 2016-10-01 14:34:01 +02:00
3a2d837f5a Decrease animated preview throttle to 300ms 2016-10-01 14:34:01 +02:00
0f404d2b25 Refactor dom initialize flag 2016-10-01 14:34:01 +02:00
5577c3ab5a Fix GalleryStorageService
GalleryStorageService is sending JSON so it couldn't serialize the
ArrayBuffer which came from serializing the Piskel. In this commit it
sends the ArrayBuffer as an Array to the server so it can store it easily.
2016-10-01 14:34:01 +02:00
baf8049ea6 Fix jshint errors 2016-10-01 14:34:01 +02:00
74b7f93ddb Fix code style errors 2016-10-01 14:34:01 +02:00
fb97533cc9 Rework frameslist for better perfomance 2016-10-01 14:34:01 +02:00
ebab5ecb3f Change frameslist throttle from 1sec to 500ms 2016-10-01 14:34:01 +02:00
37443ecdc2 Fix code style errors 2016-10-01 14:34:01 +02:00
91f0d98d63 Fix wrong colors being in current colors 2016-10-01 14:34:01 +02:00
fa716d7a6c Fix ColorSwap and Bucket tool 2016-10-01 14:34:01 +02:00
ac3e43bf61 Add caching to CurrentColorsService 2016-10-01 14:34:01 +02:00
502eb1aac4 Fix missing name and description from v2 2016-10-01 14:34:01 +02:00
218c0b511b Fix callbacks to work with the new serializer 2016-10-01 14:34:01 +02:00
a3fd2f0d89 Remove unnecessary argument 2016-10-01 14:34:01 +02:00
c522d48c8f Fix test to work with new serializer format 2016-10-01 14:34:01 +02:00
c2b283be67 Fix services to use new serializer format 2016-10-01 14:34:01 +02:00
dbbd57ae28 Fix old deserializers to match new callback func 2016-10-01 14:34:01 +02:00
fefc635e25 Add function for reading file as array buffer 2016-10-01 14:34:01 +02:00
8910bf0dbd Add model version 2 backward compatiblity 2016-10-01 14:34:01 +02:00
f607c65789 Add model version 3 deserializer 2016-10-01 14:34:01 +02:00
2962a838d3 Add model version 3 serializer 2016-10-01 14:34:01 +02:00
7eab386122 Make sure opacity is a float and rounded 2016-10-01 14:34:01 +02:00
0c0aa5f2c9 Add caching to CurrentColorsService 2016-10-01 14:34:01 +02:00
bb7d5c862f Remove unnecessary rendering 2016-10-01 14:34:01 +02:00
f0f79754f1 Remove loop and use the pixels directly 2016-10-01 14:34:01 +02:00
a097d0b897 Fix frame processor caching 2016-10-01 14:34:01 +02:00
a1ab693fb5 Remove nested loop 2016-10-01 14:34:01 +02:00
7707aca03e Change nested loop and directly change pixels 2016-10-01 14:34:01 +02:00
f829d589d5 Improve frame colors worker perfomance by caching 2016-10-01 14:34:01 +02:00
712262b82a Format some code and remove unnecessary logging 2016-10-01 14:34:01 +02:00
0bbb4ff2d5 Remove 2nd level cache 2016-10-01 14:34:01 +02:00
6ee23e22df Throttle frameslist and preview rendering 2016-10-01 14:34:01 +02:00
f5c98cf0b3 Rework pixel storage, manipulation, rendering 2016-10-01 14:34:01 +02:00
06abdca62e Change model version to 3
The new serializing will use typed arrays / blob.
2016-10-01 14:34:01 +02:00
2ca97b48e7 Add another performance tests for layers and undo 2016-10-01 13:56:53 +02:00
132487704b Add simple performance test 2016-10-01 13:48:58 +02:00
f6be33d5bf Add performance figures to drawing tests 2016-10-01 13:09:19 +02:00
8a031d771a Merge pull request #550 from david-szabo97/feature_export-selected-frame
Add misc export: download selected frame as png
2016-09-28 14:42:46 +02:00
3be2b3d3bc Add misc export: download selected frame as png 2016-09-23 16:35:22 +02:00
7b512f6412 Merge pull request #539 from juliandescottes/fix-drawing-tests
Fix drawing tests
2016-09-01 15:51:05 +02:00
b1058c452e Issue #533: Add grunt task aliases for backward compat 2016-09-01 15:37:28 +02:00
7bc5d20b2e Issue #533: Merge test suites. use delay as timeout 2016-09-01 01:42:06 +02:00
e9ef6eb5b3 Issue #533: drawing tests, fix keyboard event replay on osx 2016-09-01 00:14:13 +02:00
a2d5e6ff04 Issue #533: Fix drawing tests cross-browser/OS issues 2016-09-01 00:12:07 +02:00
4d12908363 Merge pull request #536 from david-szabo97/update_phantomjs_casperjs
Update PhantomJS and CasperJS
2016-09-01 00:11:01 +02:00
682ef9cf91 Merge pull request #538 from david-szabo97/hotfix-retina_icons_gitignore
Remove icons@2x.png from the repo
2016-08-31 23:08:37 +02:00
cbacd68414 Remove icons@2x.png from the repo 2016-08-31 22:40:22 +02:00
3b65b90de1 Fix package.json 2016-08-31 17:25:20 +02:00
e7ed2f9b24 Update phantomjs to 2.1.7
PhantomJS 1.9.19 doesn't support typed arrays so the tests would fail.
2016-08-31 16:27:37 +02:00
0238dffe71 Update CasperJS and refactor tests 2016-08-31 16:20:01 +02:00
52eaa8b170 Merge pull request #529 from david-szabo97/hotfix-multiple_piskel_ready_callback
Change onPiskelReady to support multiple callback
2016-08-30 00:18:53 +02:00
53d728cf3a Make code more consistent 2016-08-26 01:11:03 +02:00
d01f4ef83e Change onPiskelReady to support multiple callback 2016-08-24 22:43:16 +02:00
9c6871effc Fix layout issue when starting with small viewport height 2016-08-16 10:33:19 +02:00
2fe1fe67e5 Fix: flexbox issue on IE11 2016-08-16 10:06:42 +02:00
8867324468 Fix zoom centering when zooming with keyboard shortcuts 2016-08-16 09:53:14 +02:00
1bf326fbd8 release: set version to 0.9.0-SNAPSHOT 2016-08-16 01:43:26 +02:00
eef85c57b7 release: version 0.8.2 2016-08-16 01:11:07 +02:00
d4e9b1e896 Merge pull request #516 from juliandescottes/feature-drag-selection
Feature drag selection
2016-08-16 01:10:18 +02:00
8e3ac50f81 Issue #290: cleanup unused code in SelectionManager 2016-08-16 01:04:55 +02:00
f4cbabe2ce Issue #290: selection tools: clear hasSelection flag when calling commitSelection 2016-08-16 00:40:01 +02:00
69393127fa Issue #290: rename dismissSelection to commitSelection 2016-08-16 00:40:01 +02:00
fc7fc6d9b0 Issue #290: Fix typo in comment 2016-08-16 00:40:01 +02:00
01aa4629cc Issue #290: Commit selection on ENTER 2016-08-16 00:40:01 +02:00
22797e5dc5 Issue #290: add missing parameter to dismissSelection in BaseSelect 2016-08-16 00:40:01 +02:00
0d5dc21a41 Issue #290: change boolean flag name to isMovingContent in BaseSelect 2016-08-16 00:40:01 +02:00
0d1210e71f Issue #290: fix wand cursor hotspot 2016-08-16 00:40:01 +02:00
34f2a9df0b Issue #163: show highlighter pixel for selection tools when no selection 2016-08-16 00:40:01 +02:00
a383e59280 Issue #290: allow to drag selection when using SHIFT while selection 2016-08-16 00:40:01 +02:00
230f1b23fc Merge pull request #518 from epicabsol/icontweaks
Cursor tweaks
2016-08-06 18:45:40 +02:00
77ccd60e77 Renamed lighten cursor
lighting.png -> lighten.png
2016-08-06 09:23:05 -07:00
5014937392 Merge pull request #517 from epicabsol/master
Correct desktop window icon
2016-08-06 13:08:26 +02:00
17e6cf9b38 Dither & stroke cursors
Added dither and stroke cursors. The line on the stroke cursor is quite
hard to see, but I think that's pretty unaviodable. I would suggest
moving to a larger cursor size.
2016-08-05 22:32:24 -07:00
d795c297f5 Lighting cursor, more tweaks
Added an icon for the lighting tool, although it's somewhat difficult to
see what it is without looking closely. I'd love to hear other ideas for
a cursor. (See juliandescottes/piskel#351)
I also reworked the hit point of the existing cursors by a few pixels.
2016-08-05 21:34:46 -07:00
f4bf053564 Reworked circle drawing cursor
Reworked circle drawing cursor to match the style of the rectangle
cursor.
2016-08-05 20:33:18 -07:00
d10c284436 Correct desktop window icon filename
I found the logo at dest/prod/logo.png, while there was no
dest/logo.png. Fixes juliandescottes/piskel#515
2016-08-05 19:06:49 -07:00
fdd4fb5b4e only update zoom for a valid modifier, fix zoom centering bug when using keyboard shortcuts 2016-07-30 00:01:32 +02:00
3e7999cfc5 Merge pull request #385 from smiegrin/master
Introduces zooming towards/away from mouse
2016-07-28 09:39:18 +02:00
f4c860ddfa Consolidates zooming into single function. 2016-07-26 09:28:18 -06:00
2dee5fcad1 Merge pull request #512 from juliandescottes/fix-move-viewport
Fix viewport shaking on touchmove event on mobile/tablet
2016-07-26 12:20:06 +02:00
4895017ebb Fix viewport shaking on touchmove event on mobile/tablet 2016-07-26 12:13:49 +02:00
81b1bca7f5 Merge branch 'master' of https://github.com/juliandescottes/piskel 2016-07-25 14:40:58 -06:00
0b1ec655ae retina: update lasso & shape select icons 2016-07-25 09:32:50 +02:00
144cf4b7de release: set version to 0.9.0-SNAPSHOT 2016-07-24 19:42:46 +02:00
a778cbb787 release: version 0.8.1 2016-07-24 19:25:15 +02:00
94b781a2e5 Merge pull request #510 from juliandescottes/scroll-selected-layer
Issue #502: scroll selected layer into view when redrawing layer list
2016-07-24 19:22:17 +02:00
ba56a32b88 Issue #502: scroll selected layer into view when redrawing layer list 2016-07-24 19:21:07 +02:00
fc0521784b Merge pull request #509 from juliandescottes/retina-icons
retina icons
2016-07-24 19:19:15 +02:00
a96bc0c72f retina icons 2016-07-24 17:06:47 +02:00
f49a9fd588 chore: update nwjs to 0.15.4 2016-07-23 00:23:07 +02:00
872afd17f7 Merge pull request #508 from leereilly/alt-option-button-osx
Replace 'alt' buttons with 'option' buttons on Macs?
2016-07-22 13:55:28 +02:00
89c4044016 Replace 'alt' buttons with 'option' buttons on Macs 2016-07-20 12:35:05 -06:00
782939039d release: set version to 0.9.0-SNAPSHOT 2016-07-10 15:56:50 +02:00
db62daccf9 release: release version 0.8.0 2016-07-10 14:14:29 +02:00
0bc7f3bc05 dev env: automatically remove fake header from desktop builds 2016-07-10 13:59:11 +02:00
4518f50efa consider layer with opacity=0 as transparent 2016-07-04 00:23:03 +02:00
01a0bcf13c extract dev header to separate template 2016-07-03 15:40:04 +02:00
94a9a1495f chore: update grunt-nw-builder to 2.0.3 (finally fixes osx app issue!) 2016-07-03 00:32:33 +02:00
cd36a57a1a export controller: add synchronized rows input, remove poweroftwo checkbox 2016-07-02 16:49:17 +02:00
b39b3befa1 Merge pull request #487 from code-dot-org/piskel-on-npm
Prepare for npm publishing
2016-06-22 12:08:31 +02:00
93055f4b4a Prepare for npm publishing
Introduces some small package changes that simplify publishing Piskel to NPM as a ready-to-use application.

Since Piskel is not simply a JavaScript "module" (not something one would 'require' into another application) its role as a package on npm is somewhat unconventional - it contains the release build of Piskel, ready to serve as a static website, and a small `piskel-root` utility that will print the absolute path to that content (which will have been installed who-knows-where by npm).

Mostly this works by adding the "files" and "bin" entries to package.json, and by adding an .npmignore file (which simply prevents npm from using your .gitignore and ignoring the built files that we want to ship).

With these settings in place you could publish to npm anytime (as long as you have permission) but I've added `preversion` and `postversion` scripts to simplify and automate the process.  Here's how you publish a release:

```
npm login # If not already logged in
npm version [major|minor|patch|<other>] # see `npm help version` for more options
```

By itself this will lint, run the full test suite, do a release build, make sure the working directory is clean, bump the version number in package.json, commit the version number change and add a git tag with the new version, push the new version to GitHub and publish the release build output to npm.

If you don't have an npm account, create one at npmjs.com.  You'll need to do the initial release.

An npm user should then be able to download the latest Piskel release by running `npm install piskel`.  They could then find the location of Piskel's index.html by running `` `npm bin`/piskel-root `` (perhaps more useful for automation purposes... our own build copies the built Piskel release from its npm-installed location to a directory where it gets served by Rails).

By itself this may not seem _that_ useful, but it's a step toward making Piskel easier to embed with other appilications.  I've got a start on the next big improvement, where a parent application can `require('piskel')` to get an API object that facilitates communication with the editor running within an iframe.  You can see an early version of that at https://github.com/code-dot-org/piskel/pull/7
2016-06-17 17:07:03 -07:00
b1fcc68924 Merge pull request #485 from code-dot-org/import-service
Extract import logic to ImportService
2016-06-17 09:46:32 +01:00
7e112776b6 Use Constants.EMPTY_FUNCTION 2016-06-16 18:13:08 -07:00
efbfeca200 Improved comments 2016-06-16 18:12:13 -07:00
e1cba9f13b Re-adopt ns convention for module definition 2016-06-16 18:09:47 -07:00
e37d93f7f9 Extract import logic to ImportService
Isolates import dialog logic from actual import logic, which makes headless import eaiser to implement.
2016-06-14 18:12:25 -07:00
c49fe4d6a0 Issue #483 - limit zoom to have 10 sprite pixels displayed on screen 2016-06-09 11:05:59 +02:00
c0f0445544 Fix Transform tool CMD modifier on OSX 2016-06-05 00:25:41 +02:00
014a1d418f Merge pull request #482 from juliandescottes/feature-tiled-drawing
Feature tiled drawing
2016-06-04 17:07:28 +02:00
4b8e5ace07 Issue #470: remove references to tiled-preview, rename preferences 2016-06-04 17:03:34 +02:00
5533664900 Issue #470: move the seamless overlay color to Constants.js 2016-06-04 16:58:49 +02:00
21b2261a9d Feature #470: update application settings layout 2016-06-04 16:50:58 +02:00
f2ff3bc74e Feature #470: Tiled drawing improvements 2016-06-04 16:50:58 +02:00
51da3ec80d Merge pull request #481 from juliandescottes/chore-update-package-fields
chore: Update package.json fields
2016-06-04 10:59:14 +02:00
92ab0602ee chore: Update package.json fields 2016-06-04 10:54:21 +02:00
7777be2226 Merge pull request #478 from code-dot-org/fix-peerDependencies
Downgrade grunt to ^0.4.5
2016-06-04 10:31:06 +02:00
30e3b4dd09 Downgrade grunt to ^0.4.5
This eliminates the peerDependencies complaints on `npm install` from
the various grunt plugins being used.  I looked at upgrading the
plugins but several still have no official support for grunt 1+.
2016-06-03 12:21:21 -07:00
3d0d82b5f7 Merge pull request #474 from juliandescottes/feature-spritesheet-options
Add FramesheetRenderer unit test
2016-05-29 22:31:01 +02:00
e6c8c59e81 Add FramesheetRenderer unit test 2016-05-29 22:30:09 +02:00
20fd196321 Merge pull request #473 from juliandescottes/feature-spritesheet-options
Feature spritesheet options
2016-05-29 11:54:28 +02:00
058b6fa333 Issue #293: add FramesheetRenderer unit tests 2016-05-29 11:47:57 +02:00
c8fa83462a Issue #293: remove unused user settings 2016-05-29 11:19:54 +02:00
fae04f3616 Issue #293: use input type number and fix linting issues 2016-05-29 11:06:45 +02:00
169ce21556 Issue #293: Add spritesheet layout options in PNG export tab 2016-05-29 10:45:19 +02:00
5a0d5da5f4 Merge pull request #472 from juliandescottes/export-tabs
Fix #446: Split export panel in tabs
2016-05-23 23:30:07 +02:00
2f295825f2 Issue #446: store selected export tab in user preferences 2016-05-23 22:51:48 +02:00
c63c764060 Issue #446: Improve export panels style consistency 2016-05-23 22:29:20 +02:00
ba8964a2af Issue #446: Cleanup gif export panel 2016-05-23 00:40:23 +02:00
f66c2578ab Issue #446: Add export tabs, move zoom controls 2016-05-22 23:37:28 +02:00
32e701aa55 Move ImageExportController to ExportController and Fix line height for toolbox titles 2016-05-22 15:49:39 +02:00
e272fbe32f Merge pull request #471 from juliandescottes/GMartigny-issue_#447_dirty_state_on_replace
G martigny issue #447 dirty state on replace
2016-05-22 15:09:57 +02:00
aa9c1659fc Issue #447: apply review comments 2016-05-22 15:05:22 +02:00
58d491cb53 Update test
Still have to be fixed
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-05-22 15:03:47 +02:00
58a1a6b043 Dirty status compare last save state index and current state index
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-05-22 15:03:47 +02:00
9b6d45e8ed Code formating
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-05-22 15:03:47 +02:00
0f00ef563a Fix the states replay loop
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-05-22 15:03:47 +02:00
eb1320de11 Move history service to linked list with random UUID
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-05-22 15:03:47 +02:00
da94e0c1fc Merge pull request #469 from mattdinthehouse/master
Implemented issue #403
2016-05-13 00:53:50 +02:00
da60495643 Had a zero instead of an O in unit test... 2016-05-12 11:15:29 +10:00
5345c1ff0a Added unit test 2016-05-12 10:56:33 +10:00
299d4fb895 Renamed Align to Center 2016-05-12 10:39:29 +10:00
7c4d03b105 Fixed style issues 2016-05-10 21:52:27 +10:00
0e4f1046d3 Implemented issue #403 2016-05-10 21:37:00 +10:00
7e88aeb9a8 Merge pull request #468 from juliandescottes/fix-layersoverflow
Issue #467: fix max height for layers & panels lists
2016-05-08 13:35:23 +02:00
7c47aa9ecd Issue #467: style changes: smaller toolbox borders, layout fixes 2016-05-08 13:28:19 +02:00
c1d8c7a20e Issue #467: fix max height for layers & panels lists 2016-05-08 04:12:43 +02:00
e5ab4e53d7 Merge pull request #466 from juliandescottes/greenkeeper
greenkeeper: update dependencies
2016-05-07 16:04:35 +02:00
1c41bbee82 greenkeeper: update dependencies 2016-05-07 15:45:55 +02:00
be79eb2f6f Merge branch 'master' of https://github.com/juliandescottes/piskel 2016-05-04 16:31:53 -06:00
f32d5dea20 Merge pull request #456 from juliandescottes/issue352-selected-color
Issue #352: add gold/black SVG backgrounds for selected color
2016-04-22 00:14:58 +02:00
806b447f93 Issue #352: add gold/black SVG backgrounds for selected color 2016-04-22 00:08:14 +02:00
85eed8a2e2 Merge pull request #460 from juliandescottes/issue458-colorformat
Issue #458: format selected color from spectrum  as HexString
2016-04-21 23:52:30 +02:00
78932048e8 Issue #458: format selected color from spectrum as HexString 2016-04-21 23:44:42 +02:00
cede7955dd Merge pull request #457 from juliandescottes/greenkeeper-staging
greenkeeper: update dependencies
2016-04-21 22:42:11 +02:00
77fb50701f greenkeeper: update dependencies 2016-04-21 22:37:58 +02:00
d46ab48c1b Merge pull request #440 from clementleger/c_file_export
C file export
2016-04-18 16:48:16 +02:00
e41b8f740b C Export: Remove temporary canvas and directly use the rendered one for export 2016-04-11 16:43:26 +02:00
dfb8fec0c9 C export: fix after review 2016-04-11 14:33:58 +02:00
b3da940943 Merge pull request #445 from robmuh/master
Warp -> Wrap in move tool spelling
2016-04-10 14:14:22 +02:00
2a1073d0c5 Warp -> Wrap in move tool spelling 2016-04-09 13:06:33 -04:00
4927557c89 C export: Fix rgb ordering in uint32_t 2016-04-06 19:38:11 +02:00
d176973e72 C export: add static const qualifier for arrays 2016-04-06 19:17:39 +02:00
664821b9f5 Fix coding style and better output 2016-04-05 23:01:27 +02:00
1b553d28e3 Export: add c file exporter 2016-04-05 22:00:50 +02:00
c96dde9972 Fix #419: upgrade nwjs version to 0.12.3 2016-03-31 03:42:53 +02:00
ba98256a08 Merge pull request #435 from juliandescottes/add-layer-opacity-2
Add layer opacity support
2016-03-26 20:48:40 +01:00
327df539a7 Issue #414: part10: support opacity in preview renderers 2016-03-24 02:17:57 +01:00
99b00bc57f Issue #414: part 9: persist layer opacity when resizing 2016-03-24 02:17:57 +01:00
add97baf54 Issue #414: part8: Support transparency for GIF export
Transparent layers are rendered properly in GIFs.

As soon as a layer as some opacity (ie not 0 or 1) the GIF will be
rendered with preserveColors set to false. This could be improved,
preserveColors could still be applied if the flattended picture has
only opaque pixels, for a color count lower than the GIF limit.

Other topic to handle : we are creating way to many canvas element.

A simple GIF rendering of a 50 frames animation with 10 layers creates
1000 canvas elements before creating the GIF. Should consider adding some
pooling in the CanvasUtils.createCanvas helper.
2016-03-24 02:17:57 +01:00
76a29bf51a Issue #414: part7: Support transparency for ZIP export
Added renderFrameAt API to LayerUtils
Reuse LayerUtils and PiskelController renderFrameAt in PngExportController
2016-03-24 02:17:57 +01:00
7bf2662b66 Issue #414: part6: Support transparency when exporting as PNG spritesheet
Added flattenFrameAt to LayerUtils.
Added renderFrameAt to PiskelController (using flattenFrameAt)
Use renderFrameAt in PiskelRenderer (which is used for PNG spritesheet)

chore: renamed createLayerFromSpritesheet to createFramesFromSpritesheet
       (in LayerUtils)
2016-03-24 02:17:57 +01:00
d2dc42e7cf Issue #414: part5: rename PiskelController getFrameAt to getMergedFrameAt 2016-03-24 02:17:57 +01:00
186b5a305a Issue #414: part4: UI to view/update layer opacity 2016-03-24 02:17:57 +01:00
a75e78e366 Issue #414: part3: PiskelController api + history support 2016-03-24 02:17:57 +01:00
6546b520b3 Issue #414: part2: serialize and deserialize layer opacity 2016-03-24 02:17:57 +01:00
7660119b50 Issue #414: part1: add opacity to Layer model 2016-03-24 02:17:57 +01:00
6a9c9467a5 Merge pull request #433 from mattdinthehouse/master
Issue #411: Export as ZIP: Pad frame numbers with leading zeroes
2016-03-24 00:47:51 +01:00
a712764401 Syntax changes to meet code style 2016-03-23 21:50:43 +11:00
da105e6237 Moved the padding code to a new StringUtils.js utility and made the export code use it 2016-03-23 21:32:22 +11:00
e2b6f0776b Added frame and layer id padding to splittedExport 2016-03-23 20:51:08 +11:00
c7381b771f Added sprite number padding to mergedExport 2016-03-23 20:45:35 +11:00
776cf1ec87 Merge pull request #426 from juliandescottes/greenkeeper-grunt-contrib-watch-1.0.0
Update grunt-contrib-watch to version 1.0.0 🚀
2016-03-13 22:45:50 -07:00
5f49a68b62 chore(package): update grunt-contrib-watch to version 1.0.0
http://greenkeeper.io/
2016-03-12 23:20:38 +01:00
fc75334e48 Merge pull request #425 from juliandescottes/update-license-apache
Update license apache
2016-03-11 23:36:26 +01:00
fced9fa914 Update README.md 2016-03-11 23:35:48 +01:00
661c6fba7d Update LICENSE 2016-03-11 23:32:24 +01:00
539d7c7870 Merge pull request #397 from GMartigny/issue_#348
Issue #348 : colorpicker showing on top of tooltip
2016-03-11 00:58:36 +01:00
14fde4f8a0 Multi-line title on color selector 2016-03-05 17:31:56 +01:00
7088d9aa33 Revert modifications after discussion 2016-03-05 17:23:25 +01:00
c907f47f5d Merge pull request #418 from juliandescottes/greenkeeper-grunt-jscs-2.8.0
Update grunt-jscs to version 2.8.0 🚀
2016-03-05 14:54:32 +01:00
1aa6b61bee Merge pull request #415 from juliandescottes/greenkeeper-load-grunt-tasks-3.4.1
Update load-grunt-tasks to version 3.4.1 🚀
2016-03-05 14:54:21 +01:00
3043bac82c chore: update package.json dependencies (bulk) 2016-03-05 12:55:08 +01:00
fc1d23b3f5 Merge pull request #407 from juliandescottes/greenkeeper-grunt-contrib-jshint-1.0.0
Update grunt-contrib-jshint to version 1.0.0 🚀
2016-03-05 12:49:38 +01:00
f9b8a78396 Merge pull request #406 from juliandescottes/greenkeeper-grunt-contrib-clean-1.0.0
Update grunt-contrib-clean to version 1.0.0 🚀
2016-03-05 12:49:22 +01:00
a965bb0908 chore(package): update grunt-jscs to version 2.8.0
http://greenkeeper.io/
2016-03-02 21:24:14 +01:00
ba43c888be chore(package): update load-grunt-tasks to version 3.4.1
http://greenkeeper.io/
2016-03-01 07:32:46 +01:00
00ee251868 chore(package): update grunt-contrib-jshint to version 1.0.0
http://greenkeeper.io/
2016-02-17 01:47:37 +01:00
bcb6c3aca9 chore(package): update grunt-contrib-clean to version 1.0.0
http://greenkeeper.io/
2016-02-15 22:52:53 +01:00
e79183812b Merge branch 'greenkeeper-karma-0.13.21' 2016-02-13 08:25:06 +01:00
2058630768 Merge branch 'master' into greenkeeper-karma-0.13.21
Conflicts:
	package.json
2016-02-13 08:21:53 +01:00
be8a87110d Merge pull request #404 from juliandescottes/greenkeeper-karma-0.13.20
Update karma to version 0.13.20 🚀
2016-02-13 08:12:42 +01:00
54342c16d1 chore(package): update karma to version 0.13.21
http://greenkeeper.io/
2016-02-12 23:38:29 +01:00
dd2e55f65e chore(package): update karma to version 0.13.20
http://greenkeeper.io/
2016-02-12 16:23:04 +01:00
e7c53dac38 Merge pull request #398 from juliandescottes/greenkeeper-grunt-spritesmith-6.3.0
Update grunt-spritesmith to version 6.3.0 🚀
2016-02-12 06:42:07 +01:00
ebe37a612f Merge pull request #395 from juliandescottes/greenkeeper-grunt-contrib-uglify-0.11.1
Update grunt-contrib-uglify to version 0.11.1 🚀
2016-02-12 06:42:00 +01:00
ef7108a5e0 Merge pull request #400 from GMartigny/issue_#349
Issue #349 : Frame list slightly scroll on the right
2016-02-12 05:32:18 +01:00
fc9cb07be1 Revert to whole frame draggable
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-02-04 15:33:49 +01:00
ae1f880473 Merge pull request #399 from GMartigny/issue_#350
Issue #350
2016-02-04 15:10:52 +01:00
eb02e713e2 improve the sortable widget with direction, tolerance and handle
fix CSS to prevent horizontal scroll
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-02-04 11:53:08 +01:00
ecc1444b76 chore(package): update grunt-spritesmith to version 6.3.0
http://greenkeeper.io/
2016-02-04 06:26:16 +01:00
4985dfacf3 put background-position-x and -y together for compatibility
resize a bit to align with container
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-02-03 17:32:32 +01:00
365503d9b5 Merge pull request #396 from GMartigny/issue_#392
Issue #392 : Allow to close the options drawer with the escape key.
2016-02-03 15:57:43 +01:00
9bd3bf4adf code formating
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-02-03 14:17:12 +01:00
fb9c600b9f fix #348
Add a proposition to replace the title attribute.
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-02-03 12:45:44 +01:00
20ecfd431b Merge issue_#392 2016-02-03 09:29:19 +01:00
5eb936d8c2 fix #392
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-02-03 09:19:21 +01:00
f72da81fa4 chore(package): update grunt-contrib-uglify to version 0.11.1
http://greenkeeper.io/
2016-02-02 17:46:20 +01:00
30b0e5e607 add Netbeans project folder
Signed-off-by:Guillaume Martigny <guillaume.martigny@gmail.com>
2016-02-02 16:39:57 +01:00
c55a81f29b Merge pull request #393 from juliandescottes/greenkeeper-karma-jasmine-0.3.7
Update karma-jasmine to version 0.3.7 🚀
2016-02-01 13:01:45 +01:00
0712e04c12 chore(package): update karma-jasmine to version 0.3.7
http://greenkeeper.io/
2016-02-01 12:19:03 +01:00
3b6c5aa7a4 Sync upstream Jan 31 2016 2016-01-31 16:41:34 -07:00
d2ac600d7a Merge pull request #390 from juliandescottes/greenkeeper-grunt-spritesmith-6.2.0
Update grunt-spritesmith to version 6.2.0 🚀
2016-01-30 14:20:59 +01:00
049faba83e Merge pull request #391 from juliandescottes/greenkeeper-grunt-jscs-2.7.0
Update grunt-jscs to version 2.7.0 🚀
2016-01-30 14:20:32 +01:00
cb5ece914e chore(package): update grunt-jscs to version 2.7.0
http://greenkeeper.io/
2016-01-29 18:07:14 +01:00
b90887b98c chore(package): update grunt-spritesmith to version 6.2.0
http://greenkeeper.io/
2016-01-29 06:19:56 +01:00
cc62c5b3cb chore : fix ShortcutServiceTest on macosx 2016-01-24 13:02:32 +01:00
e8f6bcee63 Merge remote-tracking branch 'upstream/master' 2016-01-18 07:39:31 -07:00
01eb0cdb43 Merge pull request #384 from juliandescottes/greenkeeper-grunt-contrib-jshint-0.12.0
Update grunt-contrib-jshint to version 0.12.0 🚀
2016-01-18 00:35:20 +01:00
412067ad90 Introduces zooming towards/away from mouse 2016-01-17 16:30:21 -07:00
857524dee4 chore(package): update grunt-contrib-jshint to version 0.12.0
http://greenkeeper.io/
2016-01-17 19:11:00 +01:00
73b165ef0c chore : fix jshint errors "thanks" to caret version range from grunt-contrib-jshint 2016-01-16 15:28:28 +01:00
cd8d5c0b52 Issue #383 : Use metaKey as ctrlKey for Move tool on OSX 2016-01-16 12:31:03 +01:00
01a0cb14fd Merge pull request #382 from juliandescottes/greenkeeper-grunt-spritesmith-6.1.1
Update grunt-spritesmith to version 6.1.1 🚀
2016-01-13 23:27:15 +01:00
4394e29db0 Merge branch 'master' into greenkeeper-grunt-spritesmith-6.1.1 2016-01-13 23:24:13 +01:00
4361992014 Merge pull request #378 from juliandescottes/greenkeeper-karma-phantomjs-launcher-0.2.3
Update karma-phantomjs-launcher to version 0.2.3 🚀
2016-01-13 23:23:12 +01:00
b46d882c18 Merge branch 'master' into greenkeeper-karma-phantomjs-launcher-0.2.3
Conflicts:
	package.json
2016-01-13 23:20:24 +01:00
00a162a22e Merge branch 'greenkeeper-karma-0.13.19' 2016-01-13 23:18:53 +01:00
af382401be Merge branch 'master' into greenkeeper-karma-0.13.19
Conflicts:
	package.json
2016-01-13 23:18:38 +01:00
aaaf824ad7 Merge branch 'greenkeeper-karma-0.13.18' 2016-01-13 23:05:10 +01:00
97690ce486 Merge branch 'master' into greenkeeper-karma-0.13.18
Conflicts:
	package.json
2016-01-13 23:04:51 +01:00
f58a54e2ea Merge pull request #377 from juliandescottes/greenkeeper-grunt-jscs-2.6.0
Update grunt-jscs to version 2.6.0 🚀
2016-01-13 23:03:35 +01:00
a2fce811dd Merge pull request #376 from juliandescottes/greenkeeper-karma-0.13.17
Update karma to version 0.13.17 🚀
2016-01-13 23:03:20 +01:00
42aefa6851 Merge branch 'greenkeeper-load-grunt-tasks-3.4.0' 2016-01-13 23:02:26 +01:00
31edd71c41 Merge branch 'master' into greenkeeper-load-grunt-tasks-3.4.0
Conflicts:
	package.json
2016-01-13 23:00:15 +01:00
34bfe0668c chore(package): update grunt-spritesmith to version 6.1.1
http://greenkeeper.io/
2016-01-12 02:56:16 -08:00
936991cefa chore(package): update karma to version 0.13.19
http://greenkeeper.io/
2016-01-05 16:57:32 -08:00
f7112bb005 chore(package): update karma to version 0.13.18
http://greenkeeper.io/
2016-01-05 01:16:12 +01:00
5369b31dbc chore(package): update karma-phantomjs-launcher to version 0.2.3
http://greenkeeper.io/
2016-01-04 23:54:38 +01:00
323ab36a1b chore(package): update grunt-jscs to version 2.6.0
http://greenkeeper.io/
2016-01-04 21:09:43 +01:00
016079bdc8 chore(package): update karma to version 0.13.17
http://greenkeeper.io/
2016-01-04 16:36:17 +01:00
b394a69904 chore : nwjs config for macos build 2015-12-29 23:44:02 +01:00
e8eafb8004 Merge pull request #373 from juliandescottes/greenkeeper-karma-0.13.16
Update karma to version 0.13.16 🚀
2015-12-25 07:59:39 +01:00
777cbb5b0a chore(package): update karma to version 0.13.16
http://greenkeeper.io/
2015-12-24 21:49:52 +01:00
4cb78b283c Merge pull request #372 from juliandescottes/greenkeeper-karma-phantomjs-launcher-0.2.2
Update karma-phantomjs-launcher to version 0.2.2 🚀
2015-12-24 12:47:22 +01:00
dd6920f641 chore(package): update karma-phantomjs-launcher to version 0.2.2
http://greenkeeper.io/
2015-12-24 12:39:26 +01:00
152e6c9c0d release : bump version to 0.7.0-SNAPSHOT 2015-12-22 19:48:46 +01:00
b0e6e31b88 release : bump version to v0.6.0 2015-12-21 23:12:14 +01:00
0d4c8cd5df chore(package): update load-grunt-tasks to version 3.4.0
http://greenkeeper.io/
2015-12-19 18:28:29 +01:00
f756266d6c Merge pull request #366 from juliandescottes/greenkeeper-karma-phantomjs-launcher-0.2.1
Update karma-phantomjs-launcher to version 0.2.1 🚀
2015-12-14 23:13:00 +01:00
ae56e9422f chore : add peer dependency phantomjs 2015-12-14 23:05:45 +01:00
771e3d0981 chore(package): update karma-phantomjs-launcher to version 0.2.1
http://greenkeeper.io/
2015-12-11 02:13:50 +01:00
eff4ac3056 chore : update nw builder, fix desktop build 2015-12-09 23:02:44 +01:00
22e876c844 Merge pull request #365 from juliandescottes/greenkeeper-grunt-jscs-2.5.0
grunt-jscs@2.5.0 breaks build ⚠️
2015-12-09 22:44:08 +01:00
21d4857b74 Update deps, use grunt-connect instead of express, fix jscs errors 2015-12-09 22:38:58 +01:00
8c29afbca6 chore(package): update grunt-jscs to version 2.5.0
http://greenkeeper.io/
2015-12-09 21:57:34 +01:00
8f558fb798 Rollback dependency update 2015-12-09 10:33:41 +01:00
c56161ee91 Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-12-09 00:36:26 +01:00
09969253d3 Closes #364 : Update all dependencies 2015-12-09 00:34:47 +01:00
3c31746785 chore(package): update dependencies
http://greenkeeper.io/
2015-12-09 00:34:47 +01:00
a928a2819f Merge pull request #360 from juliandescottes/improve-straight-lines
Improve straight lines
2015-12-04 14:46:18 +01:00
172da85f15 Issue #146 : removed unused constant in PixelUtils 2015-12-04 14:39:20 +01:00
f5a33dc39a Issue #146 : add unittest for line & uniform lines
Uniform lines step is now capped so that the step remains lower
than min(dx, dy). If the step would be greater than this value,
use Infinity and draw a straight line
2015-12-04 14:30:36 +01:00
00f0debf12 Issue #146 : Move line creation utils to PixelUtils 2015-12-02 13:59:58 +01:00
20b7eb2a3c Issue #146 : Improve shift+stroke to draw more uniform lines 2015-12-02 00:46:11 +01:00
c70e339296 Issue #338 : disable sizeInput sync if maintainration is off in usersettings 2015-12-02 00:44:13 +01:00
6583d8f8b9 Issue #357 : Trans. -> white if too many colors + add test files 2015-12-01 20:07:26 +01:00
e1592a8ace Merge pull request #359 from juliandescottes/gif-transparency-bug
Issue #357 : prevent transparency in GIF export if more than 256 colors
2015-12-01 14:35:04 +01:00
5b567683a7 Issue #357 : prevent transparency in GIF export if more than 256 colors 2015-12-01 14:17:26 +01:00
4d8b093941 Fixes #355 : IconMarkupRenderer:render signature changed 2015-12-01 01:16:04 +01:00
f828471f0d Merge pull request #354 from juliandescottes/add-brush-size
Add brush size
2015-12-01 01:06:40 +01:00
92d5a4a2fe Issue #258 : Add pensize support to DrawingTest + add pensize test suite 2015-12-01 00:54:18 +01:00
f0ed4927e8 Issue #258 : Move resize method to utils + add unit test 2015-12-01 00:54:17 +01:00
67b66e4a10 Issue #258 : Support pensize for DitheringTool 2015-12-01 00:54:17 +01:00
f767d24280 Issue #258 : Update test recorder after ToolController refactor 2015-12-01 00:54:16 +01:00
27061291a3 Issue #258 : Simplify Lighten & update test 2015-12-01 00:54:16 +01:00
12ac85f0f6 Issue #258 : add support for left/right keys + bugfix 2015-12-01 00:50:57 +01:00
3525b318a6 Issue #258 : KB shortcuts to increase/decrease pensize 2015-12-01 00:50:56 +01:00
fce9bb5727 Issue #258 : Fix replay for Stroke tool with != pensizes 2015-12-01 00:50:55 +01:00
3cc3204939 Issue #258 : Update style and tooltip 2015-12-01 00:50:55 +01:00
222c65a8a5 Issue #258 : Initial implementation : missing tests + cleanup 2015-12-01 00:50:54 +01:00
4196576c19 Merge pull request #353 from juliandescottes/reduce-http-calls
Reduce http calls
2015-12-01 00:45:10 +01:00
06e864ca0a Issue #344 : Add clean:all task 2015-12-01 00:41:02 +01:00
3d1a24d5cf Issue #344 : cleanup dest folder(s), cleanup Gruntfile 2015-12-01 00:41:02 +01:00
070003a414 Issue #344 : Escape django template tags 2015-12-01 00:41:01 +01:00
7d5259acd7 Issue #344 : include piskel-boot in index.html 2015-12-01 00:41:00 +01:00
2b28577813 Issue #344 : Avoid templating syntax conflict with Django 2015-12-01 00:41:00 +01:00
7e1451fa8d Issue #344 : Remove iframes loader, Gruntf cleanup 2015-12-01 00:40:59 +01:00
dd1d2bf441 Issue #344 : Add watch:dev task to rebuild sprites 2015-12-01 00:39:51 +01:00
8aa6eff715 Issue #344 : Add image spriting using spritesmith 2015-12-01 00:39:37 +01:00
6f5e2f130e Fixes #346 by blurring disabled buttons 2015-11-30 16:46:27 +01:00
26f4448175 Merge pull request #343 from juliandescottes/fix-color-format
Issue #332 : always use lowercase hexstring format for colors
2015-11-27 23:05:09 +01:00
82510314a5 Issue #332 : always use lowercase hexstring format for colors 2015-11-27 22:58:11 +01:00
7fea616f0f Merge pull request #342 from juliandescottes/store-resize-to-userpref
Store resize to userpref
2015-11-25 00:49:46 +01:00
8d26d693ff Issue #338 : Cleanup public/private in SettingsController 2015-11-25 00:40:12 +01:00
9329a5fd03 Issue #338 : Remove jquery from settingscontroller, destroy setting controller when closing drawer 2015-11-25 00:36:19 +01:00
1c1f6c11ab Merge branch 'master' into store-resize-to-userpref 2015-11-20 00:27:05 +01:00
cfe3545eec Merge pull request #339 from juliandescottes/add-straight-lines
Issue #146 : Draw straight lines
2015-11-20 00:16:18 +01:00
b27e6b6f66 Issue #146 : Draw straight lines 2015-11-20 00:09:18 +01:00
30c3cdbcc5 Issue #338 : Store resize prefs to userpref 2015-11-19 08:18:26 +01:00
392204e5c5 Issue #335 : Remove autocomplete from settings input text fields 2015-11-13 08:51:05 +01:00
0dff1f7a9a Merge pull request #334 from juliandescottes/add-custom-shortcuts
Close #287
2015-11-13 00:13:34 +01:00
6d309419d3 Issue #287 : Move utility functions from Shortcuts.js to ShortcutService 2015-11-12 23:14:57 +01:00
460688e2d5 Issue #287 : Move helptext to tooltip, change cheatsheet column layout 2015-11-12 22:47:51 +01:00
947306a80c Issue #287 : Update helptext 2015-11-12 20:31:50 +01:00
0b439e1b00 Issue #287 : Add forbidden keys & helptext 2015-11-12 20:31:50 +01:00
676cbd17ea Issue #287 : Edit shortcuts from cheatsheet window (WIP) 2015-11-12 20:31:49 +01:00
2e3558ef08 Issue #287 : Edit shortcuts from the Cheatsheet dialog (WIP) 2015-11-12 20:31:49 +01:00
b5234089cd Issue #287 : Move CheatsheetService to CheatsheetController + DialogsController 2015-11-12 20:31:48 +01:00
5cda3e57b4 Issue #287 : fix shortcut for cheatsheet 2015-11-12 20:31:47 +01:00
ca3bbf1c57 Issue #287 : Shortcuts now rely on Shortcut instances. Shortcut key can be changed dynamically. 2015-11-12 20:31:47 +01:00
8081d5e232 Issue #287 : Fix unit test mocks 2015-11-12 20:31:46 +01:00
2c75daecb1 Issue #287 : Move shortcut definition to tool instances 2015-11-12 20:31:46 +01:00
c11e0d5d8d Issue #287 : Rename addShortcut/removeShortcut to less ambiguous register/unregister 2015-11-12 20:31:45 +01:00
107751b7eb Merge branch 'AlexHolly-gruntfile' 2015-11-11 22:30:20 +01:00
8ec47506bf Issue #331 : Gruntfile : host as variable 2015-11-11 22:28:10 +01:00
6311049210 Merge pull request #326 from AlexHolly/touch_s-pen
Tablet Touch & s-pen
2015-11-07 14:01:09 +01:00
4cf6088441 tweak valid checks and event types 2015-11-05 16:12:27 +01:00
00a05ee839 fix style error 2015-11-03 15:00:29 +01:00
73badf06b0 remove strange file 2015-11-03 03:49:41 +01:00
ea679913f9 tablet touch and s-pen 2015-11-03 03:42:31 +01:00
ba33533178 tablet touch and s-pen input 2015-11-03 03:34:13 +01:00
c32b327f23 Fix #322 : Save As button no longer works on offline builds 2015-10-25 00:18:01 +02:00
573d7ca051 Fix SwapColor will not replace color if their string representation is using a different case 2015-10-24 15:41:21 +02:00
23b82b4cf0 Releasing : bump package.json to 0.6.0-SNAPSHOT 2015-10-09 23:42:18 +02:00
f61682bb8d Issue #300 : follow-up : use shorter label 2015-10-08 23:55:45 +02:00
a9e04a4abd Merge pull request #320 from juliandescottes/fix-layerpreview-tooltip
Issue #312 : Improve layer preview tooltip + mutualize tooltip code
2015-10-08 00:51:47 +02:00
0021de35b4 Issue #312 : Improve layer preview tooltip + mutualize tooltip code 2015-10-08 00:47:35 +02:00
1e693e4e36 Merge pull request #318 from juliandescottes/fix-colorswap-memoryusage
Issue #315 : custom replay for Swap Color
2015-10-06 01:28:57 +02:00
a3a75b6096 Issue #315 : custom replay for Swap Color 2015-10-06 01:22:43 +02:00
2448e65ffa Merge pull request #317 from juliandescottes/add-lasso-tool
Add lasso tool
2015-10-06 00:51:43 +02:00
814db90e54 Issue #311 : Fix post-rebase issues 2015-10-06 00:49:30 +02:00
3585c2debd Issue #311 : Fix incomplete lasso issue when creating a new selection 2015-10-06 00:21:14 +02:00
8b983414a6 Issue #311 : adding jsdoc to PixelUtils visitConnectedPixels 2015-10-06 00:21:13 +02:00
4d53f5e3b7 Issue #311 : Cleanup and comments 2015-10-06 00:21:13 +02:00
9811a3a604 Issue #311 : Add drawing test for lasso 2015-10-06 00:21:12 +02:00
28912fc58f Issue #311 : Add lasso tool. Implementation and cleanup 2015-10-06 00:21:12 +02:00
7554b3355c Fix #311 : Add Lasso tool icons 2015-10-06 00:20:58 +02:00
f7592f864b Issue #311 : Add lasso tool initial commit 2015-10-05 23:51:10 +02:00
66fa71affd Merge pull request #316 from juliandescottes/fix-transformtool-savestate
Issue #315 : Implement custom replay for transform tools + add drawin…
2015-10-05 00:22:51 +02:00
a0c9f2923e Issue #315 : Fix replay with alt/shift/ctrl modifiers 2015-10-02 02:04:03 +02:00
c9529dc65c Issue #315 : avoid saving state when replaying state 2015-10-02 01:48:35 +02:00
a8f727fdcd Issue #315 : Implement custom replay for transform tools + add drawing test support 2015-10-02 01:27:59 +02:00
48d1214a6d Merge pull request #314 from juliandescottes/add-save-service
Add save service
2015-10-01 01:10:23 +02:00
b859857b2d Issue #277 : Switch HeaderController to events instead of infinite setTimeout 2015-10-01 01:07:29 +02:00
669d7a21cb Issue #277 : Fix FF bug showing native save popup despite preventDefault 2015-10-01 01:06:54 +02:00
a286d5926a Issue #277 : Cleanup save controller 2015-10-01 00:30:36 +02:00
92cc986fb6 Merge pull request #300 from jnlopar/exportscale
Adds the ability to export a scaled spritesheet.
2015-09-29 08:34:35 +02:00
da1f26291c Adds superclass destroy call to ImageExportController. 2015-09-28 17:14:48 -07:00
a92e198519 Adds input event listener to scaling factor. 2015-09-28 17:10:40 -07:00
91ffce0bfe Makes scaling export more compact and adds tooltip. 2015-09-28 17:10:25 -07:00
acb6fd2172 Issue #277 : Add unit test for StorageService 2015-09-25 01:41:22 +02:00
055bcdb001 Enhancement : Adding CTRL+SHIFT+Z as REDO shortcut 2015-09-20 12:25:54 +02:00
fe9875841a Issue #277 : Add isSaving state to storageService 2015-09-20 11:19:17 +02:00
e5be581e19 Issue #277 : Move all name update logic to a dedicated controller polling the model 2015-09-20 10:42:15 +02:00
6620f7e5a9 Issue #277 : Add global StorageService, enable CTRL+S 2015-09-20 10:42:14 +02:00
758cc6202a Issue #277 : Add new css file to style list 2015-09-20 10:41:49 +02:00
d96c1a9c06 Issue #277 : Extract save panel css to dedicated file 2015-09-20 10:41:49 +02:00
551e15e67b Issue #277 : Move storage services to dedicated package 2015-09-20 10:41:48 +02:00
d576c56068 Merge pull request #310 from juliandescottes/Integrate-SelectedColorsService
Integrate selected colors service
2015-09-20 02:32:15 +02:00
fddec5c95c Fix : Update package.json version to 0.5.5-SNAPSHOT 2015-09-20 02:20:17 +02:00
1abd6113a3 Fix : Speed up dialog animations 2015-09-20 02:20:16 +02:00
ef05cc4fd1 Refactor : move FrameTransform to transform package 2015-09-20 02:20:16 +02:00
87341b049e Fix : Add peer dependency to jasmine-core in package.json 2015-09-20 02:20:15 +02:00
9f31b2c7e4 Fix : Hide grid when zoom no longer allows proper display 2015-09-20 02:20:15 +02:00
3f992cbb4a Applying review comments 2015-09-20 02:12:59 +02:00
0bdcf38d2f Fix : Update package.json version to 0.5.5-SNAPSHOT 2015-09-19 22:58:01 +02:00
d254a9b72e Fix : Speed up dialog animations 2015-09-19 18:22:56 +02:00
d8d7f1adea Refactor : move FrameTransform to transform package 2015-09-19 17:56:32 +02:00
d6a85aaf6f Fix : Add peer dependency to jasmine-core in package.json 2015-09-19 00:25:33 +02:00
1bc85bfbca Fix : Hide grid when zoom no longer allows proper display 2015-09-19 00:07:14 +02:00
90c2ed3470 Removing states in class members and using a SimplePen#draw method instead. 2015-09-17 02:26:59 +02:00
5a469202e9 Remove color argument from BaseTool/BaseSelect interfaces 2015-09-16 23:40:44 +02:00
8faa6db4c0 Fix SelectedColorsService tests 2015-09-16 23:36:55 +02:00
8d618fc31c Merge remote-tracking branch 'origin/Integrate-SelectedColorsService' into Integrate-SelectedColorsService
Conflicts:
	src/js/controller/DrawingController.js
	src/js/tools/drawing/DitheringTool.js
2015-09-16 23:03:57 +02:00
e9c99a241f Migrate tools to BaseTool#getToolColor 2015-09-16 22:58:13 +02:00
3209c50304 Create MouseStateService and integrate 2015-09-16 22:57:53 +02:00
5d38804523 Integrate selectedColorsService into PaletteController and PaletteListController
- update selectedColorsService getColors array API to explicit
getPrimary/getSecondary
- update drawing test helper as well
2015-09-16 22:57:52 +02:00
d17f235aee Merge pull request #309 from juliandescottes/dithering-tests
Dithering tests
2015-09-16 12:59:21 +02:00
a0350ff2e8 Integrate selectedColorsService into PaletteController and PaletteListController
- update selectedColorsService getColors array API to explicit
getPrimary/getSecondary
- update drawing test helper as well
2015-09-16 02:24:56 +02:00
d6351fccb3 Add dithering tool drawing tests 2015-09-16 01:13:45 +02:00
a58b643a26 Add SelectedColorsService unit tests 2015-09-16 01:13:21 +02:00
5367c75972 Merge pull request #308 from juliandescottes/dithering
Introduce basic dithering tool
2015-09-15 07:47:11 +02:00
7d964c7fde Fix dithering right-click color inversion on FF/IE
Record pressed mouse button type only at mousedown time.
On IE/FF, the button type is not available during mousemove.
Did a round of testing on both FF and Chrome.
2015-09-15 00:57:13 +02:00
d0acb625cf Applying review comments for dithering tool 2015-09-14 23:40:16 +02:00
e6950e5c1a Issue #306 : Switch implementation for memoizer 2015-09-14 22:04:25 +02:00
63449b2694 Fixing lint errors 2015-09-14 21:53:29 +02:00
ed32ddc747 Introduce basic dithering tool 2015-09-14 21:41:10 +02:00
cbb97c60d0 Issue #215 : Fix cursor coordinates regression 2015-09-14 18:47:41 +02:00
ece3105893 Merge pull request #307 from juliandescottes/add-real-size-preview
Add real size preview
2015-09-13 23:55:53 +02:00
069bfb9a90 Issue #305 : Changed naming for consistency -> original-size 2015-09-13 23:28:53 +02:00
96ab2dd781 Issue #305 : Add keyboard shortcut for native preview resolution 2015-09-13 23:07:22 +02:00
1fe327495c Issue #305 : Allow DrawingController to zoom out to real size 2015-09-13 22:44:59 +02:00
089b4ea14d Issue #306 : Selection : set opacity for overlay instead of pixel per pixel 2015-09-13 21:32:45 +02:00
3853a78019 Merge branch 'master' into add-real-size-preview 2015-09-13 19:25:29 +02:00
ee0a4c16aa Fix : Migrate to new travis infrastructure 2015-09-13 19:22:20 +02:00
84e26b28da Issue #305 : Add 1x icon, redesign popup icon 2015-09-13 19:16:08 +02:00
cffb68c88c Fix : Hand cursor was not properly centered 2015-09-13 17:33:06 +02:00
489298e87a Issue #304 : Blur FPS range input only on change event 2015-09-13 15:49:18 +02:00
dffe23746c Issue #303 : Reset input[type=range] padding in reset.css 2015-09-13 15:12:46 +02:00
8c629bd842 Issue #301 : Switch between light and dark highlighted pixel color 2015-09-12 17:54:11 +02:00
251ceae318 Merge branch 'exportscale' of https://github.com/jnlopar/piskel into exportscale
Conflicts:
	src/css/settings.css
2015-09-06 11:57:55 -07:00
c7a80ebdec Drops settings back to 550px, since it doesn't need the extra 50 anymore. 2015-09-06 11:57:02 -07:00
2280740421 Drops settings back to 550px, since it doesn't need the extra 50 anymore. 2015-09-06 11:54:35 -07:00
c6287653f9 Moves the scaling factor into spritesheet export. Cleans up CSS and makes description spans with inline styles into divs. Adds a little more margin below the scaling factor so it's not too snug with the Download PNG button. 2015-09-06 11:53:10 -07:00
bd8eaa4307 Uses ImageResizer for spritesheet export scaling. 2015-09-06 11:48:04 -07:00
c0fda032e5 Reverts change to BlobUtils. 2015-09-06 11:42:13 -07:00
744709b15b Issue #256 : update Move tool tooltip 2015-09-02 01:16:09 +02:00
6a2f7fb58d Issue #256 : add drawing test 2015-09-02 00:48:29 +02:00
479df8ced7 Issue #256 : apply move tool to all layers / all frames 2015-09-02 00:36:03 +02:00
72edf47734 Adds the ability to export a scaled spritesheet. 2015-08-31 11:21:17 -07:00
6b6674a04d Issue #215 : Dev environment : first undo/redo drawing test 2015-08-25 01:01:12 +02:00
754bc9b830 Issue #215 : Dev environment : support keyboard/undo/redo events in drawing tests 2015-08-24 23:56:09 +02:00
ff98670055 Selection Manager : fix undo/redo regression 2015-08-15 17:08:09 +02:00
4e1f6bee3f Build : add grunt desktop-mac target 2015-08-15 16:29:13 +02:00
6a4d3cb106 Keyboard Cheatsheet : extract color shortcuts to dedicated category 2015-08-14 00:01:47 +02:00
7048e1fd42 Palette toolbox : 1-9 shortcut styling update 2015-08-13 01:01:20 +02:00
cd36c07a45 Add shortcut numbers for 1-9 palette colors 2015-08-13 00:44:47 +02:00
9f0aaceb5f Merge pull request #292 from juliandescottes/copy-paste-oob-crash
Copy paste oob crash
2015-08-09 15:55:12 +02:00
99da69553c Copy paste out of bounds : added SelectionManager unit tests 2015-08-09 15:42:46 +02:00
fdb5483e87 JSCS fixes 2015-08-09 12:51:25 +02:00
1208324d4d Copy paste bug : add unit tests for FrameUtils with null value 2015-08-09 12:37:03 +02:00
5437ad8651 Merge branch 'copy-paste-oob-crash' of https://github.com/juliandescottes/piskel into copy-paste-oob-crash 2015-08-09 01:49:47 +02:00
c074217047 Add macos specific nodewebkit configuration 2015-08-09 01:22:25 +02:00
e0c9a46ed3 wip : needs tests 2015-08-07 08:37:13 +02:00
d962217f90 Issue #281 : Add app.settings & user pref for layer preview opacity 2015-07-26 02:00:46 +02:00
9800d85cb7 Add keyboard shortcuts 1 to 9 to quickly select palette colors 2015-07-24 01:16:47 +02:00
011b07c735 Palette editor : Fix blur delegation on Firefox 2015-07-22 00:10:56 +02:00
2fdc85556b Palette Editor : Fix color change from hex input 2015-07-21 23:40:55 +02:00
7a8efc56b0 Import dialog : image-preview style : display changed to block 2015-06-07 13:19:44 +02:00
0d81865f3b Adding button to reset.css font rules 2015-06-07 12:45:51 +02:00
12cfe16cb4 Cleaning up settings and dialogs CSS 2015-06-07 12:40:40 +02:00
e773f9ae6d Merge pull request #284 from JALissiak/spritesheetImport
Adding spritesheet import - fixes #188
2015-06-04 08:09:13 +02:00
5c46cfe20a Updating for pull request feedback
- Using labels for the import type radio buttons
- Non animated gifs can now be imported as a spritesheet
- Fixing frame slicing to ignore a partial frame while looping
2015-06-03 19:48:29 -07:00
2d9001db6e Updating the spritesheet import to use size
- The import dialog now allows users to select an option between single image or spritesheet importing
- The spritesheet option allows setting of the size of an indivdual frame and the offset from the left/top from which to start slicing frames
- Selecting the spritesheet option will display a frame slice grid over the preview image to give a quick view of where the frames will be made
- When importing the spritesheet blank (transparent) frames and also partial frames will be ignored
- This allows users to import spritesheets that have been packed into a larger image with excess padding
2015-06-02 21:54:26 -07:00
8ff15fd0e1 Fixing the preview frame grid stroke
- The width/height of the canvas used to draw the frame grid in the preview was incorrect, so the stroke width was too thick
- This change fixes it so the stroke width remains nice and thin by applying the correct canvas size
2015-06-01 10:50:58 -07:00
8e4ea8437f Fixing unnecessary whitespace changes
- My editor added additional whitespace to several unchanged lines, so I just reverted them
2015-06-01 10:38:10 -07:00
48f24c0cf3 Adding spritesheet import
- Updated the import dialog to allow users to specify the number of frames in the image (which defaults to 1 x and 1 y)
- Setting the frame count for x and y will draw a dotted line in the preview that shows where the image will be split into individual frames
- When imported with a frame count above 1, the source image will be split into the different frames and loaded just as if it were an animated gif
- This allows users to import existing spritesheet pngs, including those produced by the piskel export function
2015-06-01 10:29:52 -07:00
8d85093874 Fix GIF issue 2015-05-18 11:51:28 +02:00
1beeb8d6e4 Revert "Fix a GIF bug ... again"
This reverts commit f9b07b29a9.
2015-05-18 11:47:48 +02:00
f9b07b29a9 Fix a GIF bug ... again 2015-05-18 10:40:05 +02:00
9bc330e5e8 Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-05-13 11:21:24 +02:00
a51e20b370 Fix #282 : Clean build of gif.js made the issue disappear ... 2015-05-13 11:20:44 +02:00
ef6ef6256e Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-05-08 22:36:03 +02:00
4edbc29e72 Fix #281 : Zoom keyboard shortcuts on Firefox
Keycode not consistent on FF :
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode

Also added support for numpad +/- keys.
2015-05-08 22:34:29 +02:00
b72c775a04 Merge pull request #275 from MaxEden/master
Zip-Export: Split by layers option
2015-05-04 16:05:42 +02:00
0c9f04bc71 Prepare release 0.5.2 2015-05-03 11:43:38 +02:00
034057dcd2 Moved subfunctions to prototype 2015-04-30 13:17:56 +06:00
016316518d Zip-Export: Split by layers option 2015-04-29 20:20:35 +06:00
ac9ccd04e2 Fix currentcolors on sprites with many frames 2015-04-29 04:00:46 +02:00
ce8d71f47e Fix : resize panel : maintain ratio is always on 2015-04-28 13:32:55 +02:00
29cd0d80f3 Prepare 0.5.1 release 2015-04-28 07:29:01 +02:00
d3f5a41c0d Fix popup preview on Firefox 2015-04-27 22:34:50 +02:00
3f181c6248 Fix gif export transparency issue 2015-04-27 22:23:35 +02:00
8ae14281cc Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-04-26 23:34:09 +02:00
9de77c9f21 Fix : Add mac os menu (removed with nw > 0.10) 2015-04-26 23:33:49 +02:00
d31865a9ef Update windows build scripts after nw version update 2015-04-26 22:46:40 +02:00
cf62f2ac0b Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-04-26 22:13:23 +02:00
16362e1b13 Fix : Online save failing 2015-04-26 22:07:14 +02:00
aa79919496 Prepare release 0.5.0 2015-04-26 22:01:06 +02:00
6df145455e enhancement : use size-input instead of select for export 2015-04-24 14:57:01 +02:00
daceb326c5 enhancement : use size-input instead of select for export 2015-04-24 14:55:00 +02:00
5fbadc0d80 wip : Add save as button 2015-04-24 00:00:53 +02:00
473bd4705c Add save as button 2015-04-23 23:59:05 +02:00
c570d8fd75 Switching to AGPLv3 2015-04-15 17:39:56 +02:00
7909d4d94b #268 : Update README.md : license info 2015-04-15 09:08:30 +02:00
138d5d02d2 #268 : Use GPLv2 license 2015-04-15 09:07:11 +02:00
0683583da1 Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-04-15 07:28:13 +02:00
1decd64a30 Merge pull request #269 from juliandescottes/current-colors-webworker
Current colors webworker
2015-04-15 07:27:43 +02:00
9e1cfef924 fix:focus preview popup if already opened 2015-04-15 07:27:00 +02:00
e384f7d2e2 Added Blob polyfill for Phantom JS (debug mode only) 2015-04-14 23:08:53 +02:00
be3d2cf20d merge 2015-04-14 22:36:25 +02:00
54ae52e117 Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-04-14 21:31:49 +02:00
b480acc6a0 Added JSCS linter to enforce style conventions 2015-04-14 18:02:33 +02:00
007e4d4e11 Usability : keyboard shortcuts cheatsheet
- click outside of cheatsheet-wrapper closes the popup
- removed jquery from CheatsheetService
- removed label 'Keyboard shortcuts' in favor of tooltip
2015-04-14 11:09:36 +02:00
6070ebead5 Updated dependencies 2015-04-13 17:24:49 +02:00
5b081c8859 Cleanup Gruntfile.js 2015-04-13 16:30:30 +02:00
29e205d441 Merge pull request #267 from juliandescottes/uncaught-errors-crash-nodewebkit
#261 replaced throw by console.error for recoverable errors
2015-04-13 14:38:15 +02:00
1f5272415c #261 replaced throw by console.error for recoverable errors 2015-04-13 14:33:34 +02:00
d1b12a07ac fix : check undefined palette 2015-04-13 13:29:13 +02:00
f2f8158efb Merge pull request #266 from juliandescottes/fix-transparent-gifs
Fix transparent gifs
2015-04-13 13:20:20 +02:00
77877c118f unknown tinycolor 2015-04-13 13:11:36 +02:00
e0c16486d3 fix : strip # from hexcolor before parseint16 2015-04-13 13:08:42 +02:00
ba491736c1 test : add unit test for ColorUtils 2015-04-13 13:02:12 +02:00
0e817a88a7 Fix for #265 2015-04-13 11:45:50 +02:00
5d4b8b87a3 Update README.md 2015-04-13 08:53:24 +02:00
94c29c2ff5 Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-04-10 00:58:10 +02:00
e260b36585 Update save form display 2015-04-10 00:57:20 +02:00
3d42ab25b2 Merge pull request #264 from Dovaa/patch-1
Update README.md
2015-04-10 00:27:00 +02:00
0a6250141a Update README.md
There is a Linux version from 0.3.0
2015-04-09 17:12:43 -05:00
3d58bcae6c Fix jshint errors 2015-04-09 18:24:34 +02:00
281103c46e wip : replace Job by promises 2015-04-09 17:17:05 +02:00
e6ed0c28a3 wip : replace Job by promises 2015-04-09 17:16:58 +02:00
522006f67a wip : replace Job by promises 2015-04-09 17:16:48 +02:00
e11355193b Now using webworker to compute current colors 2015-04-09 17:16:26 +02:00
30cdb6d335 Fix node-webkit regression 2015-04-08 00:14:35 +02:00
c40e27bc17 Merge pull request #262 from juliandescottes/fix-palette-bugs
Fix palette bugs
2015-04-08 00:04:20 +02:00
3d6cd3e576 Fix post merge bugs for desktop mode 2015-04-07 23:54:49 +02:00
4b7b18ca6f post merge 2015-04-07 23:15:36 +02:00
9e6e39e3d8 WIP : Use workers to compute hash and current colors 2015-03-26 11:15:11 +01:00
c600d62bd2 Merge pull request #259 from leegrey/desktop-save-action
Desktop IO Features
2015-03-26 10:42:52 +01:00
f114676db7 Include save file path in "Successfully Saved" popup. Show full save path under the save button. Hide the "save to browser" portion of the save panel when running in desktop mode. 2015-03-26 20:32:27 +13:00
0ec3787fc4 change require() to window.require() so compiler does not report errors. 2015-03-25 18:36:55 +13:00
40cced7be0 Merge branch 'master' into fix-palette-bugs 2015-03-24 17:17:22 +01:00
81a9e7a678 Merge pull request #260 from juliandescottes/fix-chrome-canvas-radeon-bug
Workaround for Chrome 41 issue Canvas + Radeon :
2015-03-24 17:01:37 +01:00
6328fe760f Workaround for Chrome 41 issue Canvas + Radeon :
Issue opened at https://code.google.com/p/chromium/issues/detail?id=469906
Workaround in FrameRenderer.js is to decrease the width+height of the
fillRect of 1 pixel.
Issue seems to impact only Radeon users (not sure if all cards are
impacted)
2015-03-24 16:02:47 +01:00
932974d744 Undid changes to suppress Errors, since grunt test did not like it that way either. (Bad style.) 2015-03-24 23:09:44 +13:00
eb4941417c suppressing build errors when referring to "require" and "process" 2015-03-24 22:58:42 +13:00
93deb1c2c5 Just adding semicolons to make the linter happy 2015-03-24 22:33:14 +13:00
c9b581f6db When running in Node-Webkit, hold onto the full savePath when opening.piskel files via the gui or drag and drop. 2015-03-22 00:39:23 +13:00
6a6f75b3ce Moved desktop lO logic to new DesktopStorageService class. Bound keypresses for ctrl-o, ctrl-s, and ctrl-shift-s. Savepath is now also propagated on resize operation. SaveFile can optionally guarantee that a supplied file extension will be present on output file. 2015-03-19 23:46:53 +13:00
04a1633a90 Moved desktop FileUtils into their own class. Split PiskelFileUtils::loadFromFile() so the decoding portion can be called separately by desktop load function. "savePath" is stored in piskel instance, and propagated to new instances in HistoryService. "savePath" is also stored on load so it is available for resave. 2015-03-18 00:24:03 +13:00
b168e8ca76 Store user selected filePath on the Piskel instance stored in pskl.app.piskelController. Getter and Setter in PublicPiskelController for filePath. 2015-03-16 23:13:36 +13:00
fa6f2e5db6 Added new save functions for when running in Node-Webkit. 2015-03-15 01:40:00 +13:00
1c66282b01 Added pskl.utils.Environment for detecting if Piskel is running in Node-Webkit. 2015-03-14 00:11:24 +13:00
5cbb9b8664 ongoing : web workers for current colors service 2015-03-11 18:51:49 +01:00
6254490a23 feature #251 : Set default size in Resize pref panel 2015-03-04 08:37:37 +01:00
43e60e300c Set preview render flag when updating TILED_PREVIEW seW 2015-03-03 23:50:19 +01:00
fe95abca0f Switch to template for popup preview (easier integration) 2015-03-03 23:36:12 +01:00
bcecd3058b Popup preview : refactor, cross browser, WIP
- moved preview controllers to pskl.controller.preview
- renamed PreviewFilmController to FramesListController
- renamed AnimatedPreviewController to PreviewController
- fixed init of popup preview on IE (use ownerDocument to create
  TiledFrameRenderer container) => should try with innerHTML
- moved open popup button inside the minimap (show on hover)
2015-02-28 10:56:15 +01:00
68a807ccb5 Forgot PopupPreviewController.js 2015-02-27 23:57:14 +01:00
7a355b39a0 Refactored HistoryService, CurrentColorsService, draft for popup preview 2015-02-27 23:54:18 +01:00
0f1489727c Removed JQuery from ImportController 2015-02-26 22:07:36 +01:00
bab3d6677e Remove JQuery from all setting controllers 2015-02-26 01:25:33 +01:00
bcb709300c Added method to enable image smoothing on Canvas 2015-02-26 00:13:32 +01:00
4f2f01ea36 Wrapped applicationSettings in FORM 2015-02-23 00:32:34 +01:00
8592cd2e53 Moved resize+app settings to AbstractSettingController 2015-02-23 00:23:11 +01:00
b4c1a4c714 Merge branch 'master' into fix-palette-bugs 2015-02-22 23:08:21 +01:00
294af67099 Merge pull request #248 from juliandescottes/enhancement-increase-max-fps
Enhancement increase max fps
2015-02-22 23:07:46 +01:00
3585a6f96e Merge resize content and resize canvas in single form 2015-02-22 23:01:43 +01:00
0914e2816e Added Event utils to easily add/remove events without leaks. Added Max FPS setting to appl settings 2015-02-22 18:03:46 +01:00
0b41c0f648 Removing jquery leftover 2015-02-22 16:47:44 +01:00
beb2fa6ba9 Removed JQuery from ApplicationSettings 2015-02-21 15:41:32 +01:00
61fb6c5e6f Extract resize anchor code to dedicated widget file 2015-02-20 01:40:34 +01:00
d310a77893 Enhancement : choose anchor for resize canvas 2015-02-17 02:06:52 +01:00
84f366e7e4 enhancement : resize panel 2015-02-15 23:41:58 +01:00
561d016a45 fix : keyboard accessibility for colorpicker inpus 2015-02-12 00:39:38 +01:00
334d6ad21f fix : rename preferences tab 2015-02-10 23:09:28 +01:00
0382b3858b enhancement - cleaner UI for resize panel 2015-02-05 02:21:15 +01:00
2aa87b5fac enhancement - cleaner UI for resize panel 2015-02-05 02:16:25 +01:00
d7fef0f88b fix - log error if BackupService fails to store piskel in localstorage 2015-02-05 01:59:37 +01:00
c7131678f8 Fix mousewheel event for IE11 2015-01-24 00:00:08 +01:00
5224c9ddd8 Merge branch 'master' of https://github.com/juliandescottes/piskel 2015-01-23 23:21:14 +01:00
3265a96fe6 Prepare release 0.4.2 2015-01-23 23:17:39 +01:00
5831447f75 Fix #242, onion skin rendered not cleared if 0 frames 2014-12-27 15:02:41 +01:00
043f077408 Bug in undo when cancelling Shape tool used with Shift key 2014-12-24 08:27:54 +01:00
25bb46d097 Merge pull request #241 from juliandescottes/enhancement-support-rectangular
Enhancement support rectangular
2014-12-21 19:06:42 +01:00
5cb1d0cd03 Fixed CanvasRenderer regression + added unit test 2014-12-21 18:56:40 +01:00
123ea31191 Cleanup minimapController, center previewFilm canvas 2014-12-21 18:38:14 +01:00
1df5d0da38 Merge pull request #240 from juliandescottes/enhancement-pause-animation
Enhancement pause animation
2014-12-21 16:52:13 +01:00
50f159c982 Merge pull request #239 from juliandescottes/enhancement-performance-improvements
Enhancement performance improvements
2014-12-21 16:48:10 +01:00
df5aef363b Move to imgstore-b, change body bg 2014-12-21 16:44:10 +01:00
0642e17aa8 Draw lines of pixels instead of single pixels 2014-12-19 08:28:15 +01:00
1402394d07 Animation pauses when FPS slider at 0FPS + slight perf improvement 2014-12-18 23:57:34 +01:00
e1ba57c92f cleanup MinimapController 2014-12-18 22:29:14 +01:00
2db04fe7d6 Support rectangular resolution & maximize viewport usage 2014-12-18 21:42:03 +01:00
dc61be27f0 Update README.md 2014-11-26 08:55:53 +01:00
7fd49aaccb Removed localhost url ... 2014-11-26 07:48:15 +01:00
cffaec09b2 Prepare release 0.4.0 2014-11-25 22:54:18 +01:00
62a7755407 Merge pull request #235 from juliandescottes/feature-add-effects
Feature add effects
2014-11-25 22:43:12 +01:00
2ab1e29365 Merge branch 'master' into feature-add-effects 2014-11-23 21:54:31 +01:00
fe110a3d8e Merge pull request #233 from juliandescottes/enhancement-move-viewport
Enhancement move viewport
2014-11-23 21:53:34 +01:00
5afec16258 Cleanup of console.log in MinimapController.js-n 2014-11-23 21:48:32 +01:00
fad483ce7a Increased movement speed 2014-11-23 21:44:51 +01:00
b10e87d2b7 Fix for issue #189 : user can move the viewport via click n drag of middle mouse button 2014-11-23 21:37:34 +01:00
61ee1d9b32 Added clone tool + icon 2014-11-23 16:27:12 +01:00
ce1a5c4918 Rotate non square sprites, added rotate icon, unit tests for transforms 2014-11-23 15:03:35 +01:00
796cd4466e Added Rotate tool + abstract Transform tool 2014-11-22 00:07:11 +01:00
0f49c884f2 Mutualize HTML generation for drawing tools and transform 2014-11-21 01:15:55 +01:00
c8dae1cb79 Added mirror transformation 2014-11-19 23:00:25 +01:00
54837d0e21 Issue #228 : Zoom is very slow on Firefox 2014-11-01 14:00:35 +01:00
001e35cf7b Merge pull request #229 from etumyan/fps-oninput
Combining oninput and onchange events for the FPS counter. Close #225
2014-11-01 13:57:49 +01:00
ac5083633b Combining oninput and onchange events for the FPS counter. 2014-10-31 22:38:11 +04:00
c32af500dc add notification if image upload fails 2014-10-01 01:21:49 +02:00
dc4de32162 Added support for .PAL palettes 2014-09-30 00:58:15 +02:00
243990a90f Fixed : cache issue coming from piskel-boot file 2014-09-30 00:19:54 +02:00
96ef362cf8 preparing release v0.3.0 2014-09-28 11:20:34 +02:00
e1e029a849 Merge pull request #221 from juliandescottes/enhancement-palette-sorting
Enhancement palette sorting
2014-09-27 11:06:43 +02:00
fe5e8966a5 added shortcuts to select previous / next color in palette 2014-09-27 11:04:03 +02:00
37aa6c3d72 sort colors on image import for palette 2014-09-27 01:22:20 +02:00
d805e13d57 sort colors on image import for palette 2014-09-27 01:10:54 +02:00
a7ef57b6ee fixed color sorting for desaturated colors 2014-09-26 00:03:24 +02:00
ac08775406 improved current colors sort 2014-09-25 00:13:23 +02:00
6583d3d560 moved rgbToHex correct implementation to pskl core utils 2014-09-24 21:53:41 +02:00
b5465ca066 fixed palette import bug 2014-09-24 21:50:16 +02:00
258d13371d improved current colors sort algorithm 2014-09-24 08:15:18 +02:00
e3e6730b45 improved current colors sort algorithm 2014-09-24 07:43:04 +02:00
6ef99bba15 improved current colors sort algorithm 2014-09-24 00:26:31 +02:00
afe790e5e3 Removed unused CSS rules for old edit/merge layer actions 2014-09-23 08:05:31 +02:00
8989e984cb added dedicated style for colors-list for IE and FF + bug fixing on ProgressBarCOntroller for FF 2014-09-23 08:00:46 +02:00
00dd660571 Use dedicated service to display progress information 2014-09-22 23:51:28 +02:00
8a29b78af8 Merge branch 'master' into enhancement-palette-sorting
Conflicts:
	src/js/utils/FrameUtils.js
2014-09-21 21:56:22 +02:00
9ef46d5ec5 added FrameUtils unit tests 2014-09-21 21:39:54 +02:00
6445b44d02 Moved image import to worker 2014-09-20 09:14:21 +02:00
9afe69cb87 Split CreatePaletteControllers in ctrl + widget for colors list 2014-09-18 07:59:56 +02:00
508fb79c32 Homogeneize layout, drop palette 2014-09-18 07:18:07 +02:00
8ebdc4cd41 Enhancement palettes : Added download palette
- palettes can be downloaded as GPL palettes
- slightly tweaked the UI of hsl rgb picker
- switched preferred format of spectrum to hex
2014-09-17 01:32:59 +02:00
fab9c6e836 select new palette after saving 2014-09-16 00:37:24 +02:00
f7f9587520 Merge pull request #220 from juliandescottes/enhancement-layers-options
Enhancement layers options
2014-09-16 00:10:42 +02:00
12dcacea5a increased the timeout for Travis tests 2014-09-13 20:32:01 +02:00
9325abb924 Enhancement : Layers merge
Added drawing test + fixed drawing test runner on Mac OS X
2014-09-13 20:21:40 +02:00
4ed7338f25 Feature : merge layers
Added feature to merge a layer with the layer below
Done at #jsconfeu2014 :)

New icon in icons : merge-icon.png
TODO : reorder the icons folder, it's waaaaaaay too messy !!
2014-09-13 20:10:05 +02:00
90845b3a62 Enhancement : Color palettes
- Added clone feature when editing existing palette
- Added arrow up/down to increase decrease input values
- Paint.net palettes are supported
2014-09-09 23:53:57 +02:00
125e332b7c Enhancement : palette color creator
- Added import of GPL files
2014-09-07 18:25:17 +02:00
e457209c8f Enhancement : Palette color creator
- Added import button on create palette dialog
- implemented import from images
- missing limitation on color count when importing !!
- should remove button when editing existing palette
2014-09-07 14:31:28 +02:00
8643f4402a Moved PaletteService from pskl.service to piskel.service.palette 2014-09-07 12:27:06 +02:00
92d7109ef7 Enhancement : Palette colors creation
- Added cancel button to create palette dialog
- Added escape/unescapeHtml methods to pskl.utils
- Escaping palette name now ...
- Removed outdated comment in app.js regarding appEngine token
- Added a call to destroy() during dialogClose of AbstractDlgCtrl
2014-09-07 12:22:44 +02:00
6b32239fa1 fixed bug with hue slider capped to 255 2014-09-06 22:37:05 +02:00
8441f28ac1 Palette creator can save palettes to local storage 2014-09-06 12:37:11 +02:00
e8db80a0ec Extracted ColorPicker code to dedicated widget package (noooooooo) ; Added basic palette creation mechanism (list colors + add color) 2014-09-04 08:34:17 +02:00
7d9f8a8ccf Added color picker in create palette popup 2014-09-04 00:22:02 +02:00
073f46b0d7 starting palette implementation using creation wizard 2014-08-30 18:39:54 +02:00
32e528525c Small cleanup zip export screen 2014-08-27 01:12:29 +02:00
913ef272cf Merge pull request #214 from juliandescottes/feature-add-tests
Feature add tests
2014-08-26 23:57:45 +02:00
1a8f10c63d Merge branch 'posva-master' into feature-add-tests 2014-08-26 22:46:33 +02:00
b2ab504422 Drawing tests structure cleanup 2014-08-26 08:21:58 +02:00
35d4be5d3e Configuration clenup 2014-08-26 01:11:14 +02:00
efccfdc0c6 Added test for lighten / darken 2014-08-24 23:44:22 +02:00
895a15524d Cleanup of HistoryService, removed this.$serviceName for consistency 2014-08-24 18:10:09 +02:00
006d72a195 removed temporary file 2014-08-24 18:03:42 +02:00
13001bd7bd added drawing tests for all tools currently available 2014-08-24 17:57:30 +02:00
caebce5ec8 added test suite runner, removed tests from travis build 2014-08-23 22:45:52 +02:00
978319af20 Allow to rename basename for PNG in ZIP export option.
This may helps #192
2014-08-22 11:27:45 +02:00
a8788c83f1 add drawing tests to casper 2014-08-22 00:51:35 +02:00
56b1f421bc add drawing tests to casper 2014-08-22 00:37:35 +02:00
1955d3f8f5 First implementation of tool tester 2014-08-21 00:50:59 +02:00
17824ae1c4 Update README.md 2014-08-17 20:42:38 +02:00
34dbcedec3 Adding karma-phantomjs-launcher to package.json 2014-08-14 02:28:37 +02:00
e711050f75 Trying other version of node-webkit 2014-08-14 02:24:59 +02:00
844437dfc9 Update (hardcode to 1.4.21) npm version for travis build 2014-08-14 02:09:08 +02:00
715c148908 Update node version for travis build 2014-08-14 02:00:49 +02:00
b0ec276aac Adding karma tests to grunt build 2014-08-14 01:50:33 +02:00
8d8c40e6a6 tests update 2014-08-12 07:11:23 +02:00
6d6e80c762 tests update 2014-08-12 00:30:57 +02:00
05e8f9adac added karma runner + first test 2014-07-23 19:42:08 +02:00
1b99a22c1d Updated node and dependencies 2014-07-20 23:55:10 +02:00
280dd1a809 Merge pull request #208 from juliandescottes/feature-export-to-file
Feature export to file
2014-07-15 00:33:36 +02:00
c1900a07f0 Final fixes before new version 2014-07-15 00:31:24 +02:00
a43b20e182 fix lighten bug when starting on transparent pixel 2014-07-14 16:44:36 +02:00
b556143b66 fixed fps when restoring backup 2014-07-14 14:39:21 +02:00
19c99d1aa7 Fixed canvas ordering, fixed FPS during local import 2014-07-14 14:14:28 +02:00
dc78c3cecd Yet another history bug ! 2014-07-14 00:37:17 +02:00
829bcb8ad1 Simplified lighten + fixed frame caching bug 2014-07-13 21:01:50 +02:00
56f008bda6 restored history snapshot interval to 50 2014-07-13 18:17:13 +02:00
5350255eee fixed lighten reset + fixed history bug 2014-07-13 17:59:53 +02:00
d4884a2de5 Capture events on tmp download link created by FileUtils 2014-07-13 15:54:13 +02:00
581bd46dcd Cleanup + updated tooltips 2014-07-13 15:15:45 +02:00
1e8315f32c Switch back to imgstore-a 2014-07-13 14:11:49 +02:00
cc8460cc26 Fix gif worker URL on IE11 appengine mode 2014-07-13 14:02:35 +02:00
aa375315a2 Fixed mime type bug on Firefox 2014-07-13 01:01:33 +02:00
e5cb0717e2 cleanup 2014-07-13 00:43:35 +02:00
6af04bb599 cleanup 2014-07-13 00:21:36 +02:00
dfc3bfd181 Fixed Gruntfile for ghpages export 2014-07-12 21:14:07 +02:00
ad3dd935e0 Create 2 new dialog controllers
Image import is now triggering a popup after selecting the file.
Same for local saves.

Drag and drop of .piskel files opens the piskel immediately !

Remains to do :
- redesign the dialog for import image and browse local
- create dialog for recover session
- improve recover session to handle more than the last session
2014-07-12 15:34:50 +02:00
18ff6f88a7 Merge branch 'feature-dnd-images' into feature-export-to-file 2014-07-12 11:12:18 +02:00
b2fbe269d3 Merge branch 'master' into feature-export-to-file 2014-07-12 00:46:27 +02:00
a8ce829e6c Image dnd first implementation 2014-07-12 00:41:39 +02:00
2fabf68282 Merge pull request #203 from juliandescottes/feature-swap-color
Feature swap color
2014-07-11 00:25:22 +02:00
b66d5ee93b Cleanup of tooltip generation 2014-07-11 00:14:21 +02:00
982a5ab048 Refactoring tooltip code + display CMD on mac 2014-07-10 01:32:16 +02:00
a6d70920e2 Improve tooltip design 2014-07-09 07:56:22 +02:00
b311312260 Removed hack from ColorPicker class 2014-07-08 20:09:21 +02:00
665d2bd9bc Settled on temp icon for swap colors 2014-07-08 20:06:03 +02:00
4aac65fb9e Settled on temp icon for swap colors 2014-07-08 20:04:16 +02:00
4102e929f4 Removed unused methods from Frame 2014-07-07 23:33:29 +02:00
b3bb2472f1 perf step 1 : ok on chrome,horrible on FF 2014-07-07 22:48:13 +02:00
a6d939cc9a Fix selection paste transparent pixels 2014-07-06 23:59:07 +02:00
304a5c06da swap color : initial implementation 2014-07-06 23:56:50 +02:00
707a69182f Fixed IE issues + verisoning for iframeloader and boot 2014-07-06 17:15:18 +02:00
8f5ead43d9 Fix : remove cache issues for css, js, templates
Packaged css and js are now suffixed with the build date.
All templates are exported to a folder named after the build date.
Streamlined the build process to copy files to piskel-website.

Isolated common part between piskel and piskel-website in a separated
template, which is now completely created by the grunt build of piskel.

Added a windows CMD script to copy the static resources to piskel-website.
2014-07-06 16:17:14 +02:00
41a4ee3f3d cleanup of import tab 2014-07-06 12:55:29 +02:00
f8b6d7b0d3 Merge branch 'master' into feature-export-to-file 2014-07-05 23:53:03 +02:00
84e757768e Merge pull request #200 from juliandescottes/enhancement-horizontal-mirror
Enhancement : modifiers for Mirror pen
2014-07-05 23:11:20 +02:00
264e236473 Merge pull request #199 from juliandescottes/enhancement-overlay-shortcut
Enhancement overlay shortcut
2014-07-05 23:10:55 +02:00
96fc5f2418 Enhancement : modifiers for Mirror pen 2014-07-05 17:04:18 +02:00
26a463c4b4 Updated font-icon with a better grid 2014-07-05 14:16:53 +02:00
8e425c64d4 Add fonts to copy task 2014-07-05 11:45:10 +02:00
bf9be5de2d Fixed input range style on IE11 2014-07-05 11:41:40 +02:00
2c235e659b Fixed layout on FF, removed options in drawer 2014-07-05 11:39:02 +02:00
a77168986a Enhancement : Shortcuts for onion kin + layer prev
Added 2 new icons :
- Animated Preview Panel : toggle onion skin
- Layers Toolbox : toggle layer preview

Added an icon font generated with icomoon.

SVGs for both icons have been made under Inkscape and are kept under
misc/svg.

All reference SVGs have been moved to misc/svg.

Added 2 keyboard shortcuts for toggling onion skin / layer preview :
- alt L : toggle layer preview
- alt O : toggle onion skin
2014-07-05 11:27:11 +02:00
24186d5aec Added keyboard shortcuts 2014-07-04 19:17:02 +02:00
7b3f5ee858 Merged changes 2014-07-03 23:40:30 +02:00
939042a645 Merge pull request #195 from juliandescottes/performance-animated-preview
Performance animated preview
2014-07-03 23:29:01 +02:00
fa4e96e7e5 Added documentation in CachedFrameProcessor 2014-07-03 23:23:31 +02:00
fa626532ba cleanup of performance improvement 2014-07-03 00:48:49 +02:00
a2e2459169 cleanup of performance improvement 2014-07-03 00:09:47 +02:00
8a70943b09 Fix : fix classes extending simplePen 2014-07-02 07:34:07 +02:00
d126023c4a temp 2014-06-30 20:38:14 +02:00
f2281d7125 temp commit 2014-06-29 23:16:37 +02:00
3efa94dce5 Merge branch 'master' into feature-export-to-file 2014-06-27 07:16:48 +02:00
bd7ebc5f7d Fix : add backup service and make undo safer 2014-06-27 02:08:00 +02:00
89466d582a Feature : Save Piskel project as File
First commit :
Removed Local storage feature
Added 'download project' 'open project' options

First attempt at simplifying right panel.

To be continued ...
2014-06-23 00:49:54 +02:00
23fd3c464c Prepare 0.1.0 tag 2014-06-22 01:05:57 +02:00
5e5ec1a358 Scripts for packaging application 2014-06-22 00:05:02 +02:00
42c799d217 added scripts for desktop packaging 2014-06-21 22:39:37 +02:00
98f59fecf1 Feature : add onion skin option
New option in application settings : onion skin.
You can choose the overlay to display now :
- no overlay
- onion skin (default)
- layer preview (previous default)

Available in Application Settings panel.

Only one overlay can be used at the same time.
The onion skin overlay is driven by a new OnionSkinRenderer maanged by the
drawing.

The drawing controller is responsible for instanciating and 'choosing' the
overlay renderer.

When switching to a new overlay, other overlays are cleared and flushed
(they cache their rendering frame, flush empties the cache).

NB : flush is only available on LayersRenderer and OnionSkinRenderer for
now.
2014-06-19 23:33:57 +02:00
fbb5ccc7e2 Fix : bugs in imageToBlob and PngExportController 2014-06-17 07:46:15 +02:00
d0739e811d More cosmetic changes to README.MD ! 2014-06-14 15:04:18 +02:00
25089c1772 Add travis build status to README.cmd 2014-06-14 15:03:01 +02:00
762bd42790 Attempt to fix travis build 2014-06-14 14:55:27 +02:00
4f4cb1cf12 Attempt to fix travis build 2014-06-14 14:51:58 +02:00
2809a551d7 Fix : Export to GIF : download option
In the GIF export panel, user can now choose between :
- export online (previous 'upload' feature)
- download GIF

Labels have been updated in the PNG export panel to follow the same
convention.

CanvasToBlob library was modified and moved to dedicated utils to handle
not only canvas, but also any base64 dateURI.
2014-06-14 14:21:26 +02:00
d501129e8e Fix : retrieve piskel info from controller 2014-06-13 19:06:15 +02:00
a45407571e Fix : dont modify transparent color 2014-05-20 23:28:16 +02:00
da9cd78b56 Fix : dont modify transparent color 2014-05-20 22:42:39 +02:00
93f3526f4b Merge branch 'fix-zoom-level' 2014-05-18 17:33:25 +02:00
cdef28c60f Fix : force zoomMultiplier to 1 on using +/- 2014-05-18 17:32:20 +02:00
aafc74bab8 Merge pull request #185 from juliandescottes/fix-zoom-level
Fix zoom level
2014-05-18 17:18:17 +02:00
f1b6ea4ae3 Fix : zoom step depends on mousewheel event delta value 2014-05-18 16:33:01 +02:00
0fec4eff4a Fix: cannot detect mac touchpad : switch to throttling 2014-05-18 16:05:59 +02:00
6dc3a2bdf7 merge 2014-05-18 15:51:11 +02:00
ac2fe87558 Merge pull request #184 from juliandescottes/feature-shift-frame
Feature shift frame
2014-05-17 11:24:29 +02:00
5b4074fc38 Merge branch 'master' into feature-shift-frame 2014-05-17 11:11:29 +02:00
c7c536dc80 Fix : Loading state with delete frame/layer
The Frame and Layer selected after an undo/redo are now taken from the
next state saved in the HistoryQueue.
2014-05-17 11:03:18 +02:00
2aa8bf578b Enhancement : Move tool: shift out of bound pixels
When holding shift and using the move tool,pixels normally exiting the
frame will now be redrawn on the other end of the frame.

Makes it easy to perform sliding animations.
2014-05-17 11:01:09 +02:00
7cbf2b2794 Fix : Update tooltip text for lighten tool 2014-05-17 08:44:23 +02:00
1401c30d87 Fix : Lighten tooltip + fix for #170
Issue 170 : both selected frame and layer are kept after a resize
2014-05-17 00:38:13 +02:00
d8772bdd8d Fix : do not apply lighten if transparent 2014-05-17 00:09:59 +02:00
b0318c8b11 Merge pull request #183 from juliandescottes/feature-lighten-darken-simple
Feature lighten darken simple
2014-05-17 00:01:21 +02:00
0c441c214b Feature : darken lighten
Added new tool to lighten/darken. By default is in lightening mode. If the
user holds ctrl/cmd while using the tool, switches to darkening mode.

If the user holds shift while using the tool, then each pixel can only be
modified once per tool usage (ie user keeps hovering the same pixel, it
won't get lighter/darker after the first time). Can be useful if you want
to keep control of the amount of colors in the sprite.

TODO :
- Ability to select explicitly lighten/darken (context menu for
tools).
- Ability to set the 'step' (ie the strength of the lighten/darken)
2014-05-16 23:51:04 +02:00
7569a4343c Fix : Undo/redo for eraser 2014-05-16 22:40:09 +02:00
21a759d8eb Fix : trigger tool move on keyup to acknowledge modifier changes 2014-05-16 22:36:23 +02:00
a3c409ff94 Merge pull request #182 from juliandescottes/enhancement-gif-encoding
Enhancement gif encoding
2014-05-16 08:25:01 +02:00
a3108225f6 Fix : Zoom level : reduce zoom step on mac os + added keyboard shortcuts 2014-05-14 23:52:32 +02:00
6c882928cc Enhancement : Lossless GIF encoding
If there are less than 256 colors in the piskel, do not perform anycolor
quantization, just reuse the colors from the piskel.

Added preserveColorsParameter to gif.js library.

If nb colors>256, fallback to the previous behavior. This could be
improved by checking the number of colors for each frame. The palette is
defined independantly for each frame, so as long as a frame is <256
colors, we could reuse the original colors.

I also believe that images with more colors would get a better quality if
we could use a single color sample for all frames. This would avoid color
'gaps' as we can experience today. In any case, for piskel, < 256 is a
reasonable assumption
2014-05-12 01:06:37 +02:00
cf560fce0f Merge branch 'master' into enhancement-gif-encoding 2014-05-12 00:50:48 +02:00
cc45ede931 Initial commit 2014-05-12 00:50:13 +02:00
43957b4a13 Merge pull request #180 from juliandescottes/feature-tiled-preview
Feature tiled preview
2014-05-12 00:49:34 +02:00
384f8f71b1 Merge 2014-05-12 00:18:34 +02:00
2827bbe94a Merge pull request #179 from juliandescottes/feature-dynamic-palette
Feature dynamic palette
2014-05-12 00:10:26 +02:00
2ec71da0e8 Merge branch 'master' into feature-tiled-preview 2014-05-11 23:35:34 +02:00
a8e0fef416 Merge branch 'master' into feature-dynamic-palette 2014-05-11 23:34:49 +02:00
6fcbfe3873 Merge pull request #178 from fsvieira/master
Standalone App with node-webkit
2014-05-11 23:34:15 +02:00
0d599ae4a7 Merge branch 'master' of https://github.com/juliandescottes/piskel 2014-05-11 21:18:43 +01:00
8eb0374351 Change node webkit releases location, ignore unecessary files. 2014-05-11 21:16:57 +01:00
cfb846b6de Moved hardcoded values to constants in PaletteListController 2014-05-11 11:55:00 +02:00
94ce3907da Renamed UsedColorsService to CurrentColorsService + exposed getCurrentColors explicitly 2014-05-08 22:11:16 +02:00
453fbcf88e Fix : changed classnames used for primary and secondary color highlight in palette 2014-05-08 22:03:19 +02:00
3969867dfa Fix : bug when setting switching primary and secondary colors 2014-05-08 21:56:36 +02:00
9af23baa88 Fix : set name for tiled background checkbox 2014-05-08 21:23:15 +02:00
59195c9fb6 Tiled preview : mutualize canvas background update
When user changes canvas background, css class now applied on document
body.

Created new controller listening to Events.USER_SETTINGS_CHANGED to handle
this.
2014-05-08 20:57:31 +02:00
6ad5bde5d1 TiledPreview : follow up 2014-05-08 20:45:05 +02:00
98135d01f8 Merge branch 'master' into feature-tiled-preview 2014-05-08 01:42:53 +02:00
aa4c94e3af Feature : Tiled preview initial commiy 2014-05-08 01:41:14 +02:00
c98d25ab66 Fix : Duplicate Current Frame bug (shift+n)
Events were not raised when using Duplicate current frame on
PublicPiskelController.
2014-05-08 01:36:59 +02:00
637fa05109 Feature : Current colors palette
Created dynamic palette displaying currently used colors.
This palette is now selected by default.

New service UsedColorsService created. Listens to PISKEL_RESET and
TOOL_RELEASED and keeps track of the list of current colors.

Still need to :
- improve sorting of colors
- allow to clone the current color palette as a custom palette
- add proper getter in UsedColorService to get the list of current colors

Also I hardcoded a max-height for the palettes-list as I found no better
way of handling the case of palettes containing many colors.

Maybe should add a limit to the number of colors handled by this automatic
palette.
2014-05-07 00:43:28 +02:00
db6dff0564 change node webkit versions to work with older node versions. 2014-05-06 19:27:24 +01:00
f4108c7dbf Fix : removing useless label in resize panel 2014-05-06 07:27:12 +02:00
7ad836f9f9 Setup nw releases destinations to build folder. 2014-05-06 03:16:51 +01:00
8a85e953f1 Merge remote-tracking branch 'upstream/master'
Conflicts:
	Gruntfile.js
2014-05-06 02:53:18 +01:00
c565111947 Added grunt server and server:watch tasks 2014-05-05 23:43:23 +02:00
fa3b44baf9 Build : Added grunt server:debug target 2014-05-05 23:20:00 +02:00
f16b810ffb Merge pull request #177 from juliandescottes/enhance-build
Enhance build
2014-05-05 23:13:30 +02:00
adca1bbd08 Added grunt server task to run server+watch 2014-05-05 23:08:11 +02:00
bc23e9cea6 Enhancement : full piskel build deployed to dest
Use grunt [default] to build the application.
Target dest with a webserver to launch the application.
2014-05-05 22:36:34 +02:00
b7362c7082 Merge pull request #175 from juliandescottes/feature-resize-content
Enhancement : Possibility to resize canvas content during resize
2014-05-05 22:05:10 +02:00
0b1977b47c Fix : Fixed styling for resize content checkbox 2014-05-05 21:58:17 +02:00
1db937ae01 Enhancement : Possibility to resize canvas content during resize
- new checkbox in resize panel
- content is resized using nearest neighbor
- deactivated by default

2 bug fixes :
- remove focus after closing drawer
- fire resize event after undo/redo if size changed
2014-05-04 22:58:36 +02:00
7fb5fe93fa Make desktop app directory with all nedded files before build it. 2014-05-01 01:00:10 +01:00
b2bdb252b7 Merge remote-tracking branch 'upstream/master' 2014-04-30 23:59:47 +01:00
38f18360b8 Fix : selection : click on non transparent pixel was cancelling selection 2014-04-30 08:30:29 +02:00
d803e88c93 added node-webkit to generate standalone app. 2014-04-28 22:13:44 +01:00
a060e32b15 Enhancement : #169 : Use several meta for shortcut
- can now use shift+ctrl+alt in shortcut definition
- paste opaque for selection remapped to ctrl+shift+V
2014-04-24 13:28:21 +02:00
cf2c0e7045 Enhancement : preview copied selection + paste only opaque 2014-04-24 00:38:21 +02:00
98aad13f1e Merge pull request #168 from juliandescottes/feature-undo-redo
Feature undo redo
2014-04-23 23:56:31 +02:00
af52d9a96a Enhancement : Selection tools various enhancements
- can use BACKSPACE key to delete selection content
  when no selection, backspace retains the default behavior
- cursor for rectangle selection has been changed to crosshair
- fixed a bug where selection seemed to be cropped when released out of
  the visible canvas
2014-04-23 23:47:23 +02:00
5541d030a5 Feature : undo redo including frame/layer actions
- Frame and Layer CRUD actions are now registered and can be cancelled
- Limited performance impact while drawing
- Improved frame cache invalidation
2014-04-22 23:57:30 +02:00
c2a3ccc8d0 Simplified SAVE STATE events, added wrap method to easily build decorators 2014-04-20 13:15:30 +02:00
8335c07519 Fix : layer manager was broken 2014-04-19 20:19:24 +02:00
b8ef570077 Removed cached serializer in Frame.js 2014-04-19 20:04:43 +02:00
d45ea00ca5 Refactored piskel controller to extract the event creation 2014-04-19 16:01:51 +02:00
b7e4deae00 Fix : frame and layer should be correctly selected when loading a snapshot state 2014-04-18 13:13:42 +02:00
0cecdc74eb Temp commit 2014-04-17 01:27:49 +02:00
b712a497e2 Feature : import sprites from GIF 2014-04-12 18:54:39 +02:00
9e78086ea8 Feature : import sprites from GIF 2014-04-12 18:48:39 +02:00
a59bfcab11 Feature : import sprites from GIF 2014-04-12 18:40:25 +02:00
29fa604d74 Fix : protect LayerRenderer against fake setDisplaySize calls 2014-04-12 15:16:18 +02:00
c5accf978e Fix : Plug PreviewFilmController to USER_SETTING_CHANGED 2014-04-12 14:19:28 +02:00
76044fa6d4 Fix : Plug PreviewFilmController to USER_SETTING_CHANGED 2014-04-12 14:19:13 +02:00
23f1e8908e Enhancement : performance : event delegation for previewfilmcontroller 2014-04-12 14:15:45 +02:00
b217f8f005 Added progress bar for GIF rendering 2014-04-12 12:09:22 +02:00
09319ecc1b Added progress bar for GIF rendering 2014-04-12 12:08:53 +02:00
3abf0897d5 Enhancement : display canvas size next to cursor coords 2014-04-12 10:14:57 +02:00
ee3285089a Enhancement : shape tool + shift : now constrained to minimum 2014-04-12 09:49:29 +02:00
4804477498 Merge branch 'master' of https://github.com/juliandescottes/piskel 2014-04-11 23:36:26 +02:00
dc729ee80b Feature : display cursor coordinates
- new controller CursorCoordinatesController
- added div in right column (bottom:0)
- 3 new events : CURSOR_MOVED, DRAG_START, DRAG_END
- modified tools to fire events when necessary

The cursor coordinates are displayed when the mouse is hovering the
drawing area. When the mouse leaves the area, the indication disappears.
If the user is using a tool that involves dragging (selection, rectangle,
circle), the indicator displays the original coordinates (captured during
drag start) and the current coordinates.
2014-04-11 23:32:28 +02:00
0d3a078145 Update README.md 2014-04-11 01:14:07 +02:00
abd5ac5959 Feature : export to ZIP 2014-04-11 01:12:01 +02:00
d42064d2fe Merge branch 'feature-color-palette' 2014-04-09 23:39:20 +02:00
dd4a544d7a Bug : current layer index was a string 2014-04-09 23:38:35 +02:00
39d7d4d8c8 Enhancement : Rename layers
- added rename icon in layers list
- mutualized CSS for edit icon between palette manager and layers list
- new CSS file icons.css for actions/links/buttons using icons
- layers are no longer retrieved by name, but by index
2014-04-09 23:24:25 +02:00
78974a9a93 Merge pull request #159 from juliandescottes/feature-color-palette
Feature color palette
2014-04-07 23:00:07 +02:00
644b72cc6e Bug : New palette name was set to object MouseEvent ! :) 2014-04-02 22:53:58 +02:00
1ce633bd06 Fix : Tools event listeners are now on window
Smoother user experience. Drawing shapes, selecting etc... is no longer
blocked by either the drawing canvas or the document.
2014-04-02 22:37:01 +02:00
c9251229fc Feature : Hold shift to preserve shape ratio
- mutualized shape tools common code in a ShapeTool class
- when holding shift and drawing a frame, the ratio is preserved
- selection and shape tools now support the mouse to leave the drawing
  area
- shape tools can go 'outside' the drawing canvas
- Frame set/getPixel now check the pixel is in range instead of crashing
2014-04-02 22:21:32 +02:00
7357614d9a Fix : Window resize is erasing the canvas
Issue was coming from the cached frame renderer.
During the window resize, we update the displaySize of the frame renderer,
regardless of the fact that the dimensions changed or not.

The setDisplaySize triggers a destruction of the canvas. But the
CachedFrameRenderer will render the frame only if it detects a change. In
this case, setDisplaySize has been overrided in CachedFrameRenderer to
skip any processing if the dimensions didn't change.

This behavior could be actually done in the FrameRenderer itself, but
since this is crucial to the CachedFrameRenderer behavior, I prefer to
keep it in this class.

Alternatively, could implement a way to discard caches of
CachedFrameRenderers from the outside.
2014-03-30 23:28:18 +02:00
090443c318 Feature : Color palette : fix spectrum issue
The palette manager UI is redrawn almost everytime the model changes.
This way, UI is always in sync with the model.

However, spectrum instances are spawning everytime a redraw is performed.
They cannot be cleaned before the redraw is performed, because if a
spectrum picker is opened, it should remain like this. This allows the
cuser to keep modifying a color without having to reopen the picker each
time he/she stops on a color.

As a workaround, I keep a reference on all the spectrum containers and
destroy them all when the manager is disposed.

Ideally I'd prefer to have a single spectrum instance that I could move
around depending on which color the user wants to edit. I.e. I want to
mutualize all the picker instances ...  But this will require a bit more
work.

Also added a notification when the user saves a palette.
Updated z-index of user-message container so that it is always above the
rest of the application.
2014-03-30 22:42:28 +02:00
3be4c78883 Fix : resize application on startup to adapt correctly to narrow screens 2014-03-30 21:55:29 +02:00
3765ce3d5e Issue #158 : updated zindex of minimap zoom square 2014-03-30 21:29:44 +02:00
4410aa5420 minor fix : remove console.log in PalettesListController 2014-03-30 21:01:14 +02:00
6d62d11872 Fix : drawing with the right mouse button (FF, IE)
Mousemove events do not have the correct button information
Need to keep the state of which button is clicked at which moment

This was actually the initial implementation ...
But I removed it because I couldn't remember why we did this in the
beginning.

Added lots of 'warnings' in comments, but won't be safe until we get good
integration tests.

References :
- FF : https://bugzilla.mozilla.org/show_bug.cgi?id=297919
"What if multiple buttons are pressed during mouse move?  And how does the
integer field (button) indicate that no button is pressed?  I think this
should be wontfix -- if people need button information during mouse move events
we need a new way of getting it (buttonSet), not the same way it works for click,
etc."
- IE : couldn't find any reference ...
2014-03-30 20:39:00 +02:00
b734db28dc Css fix + bug fix : double palette created when empty local storage 2014-03-30 16:54:26 +02:00
5b7e07e11e Fixed : spectrum pickers where no destroyed properly 2014-03-30 16:20:58 +02:00
7f17e17cff Minor css fix : adding 5px margin to palettes-list-colors 2014-03-30 15:38:13 +02:00
231ae9e165 Feature : color palette
- Fixed : manager UI is redrawn after save
- the Selected palette is saved as a user preference
- default background is now the dark one
- the selected palette is not reset after closing palette manager
2014-03-30 14:56:31 +02:00
4947cc4820 moved css to avoid img relative path issue after build 2014-03-30 03:11:31 +02:00
0e94606f41 moved css to avoid img relative path issue after build 2014-03-30 03:10:34 +02:00
b0ed5e4a7f Feature : palette color manager
- implemented save all functionality
- minor css update
2014-03-30 01:59:14 +01:00
85b64a9f04 test 2014-03-30 01:12:01 +01:00
d2ec797496 integrate palette list with palette manager 2014-03-30 01:10:00 +01:00
41e52a7a39 minor css fixes 2014-03-29 18:49:31 +01:00
f2da622edb Merge + palette manager 1st drop
- can create palettes
- palettes are persisted to local storage
- can add colors to palettes using spectrum color picker
- can remove created palettes
- can revert changes on unsaved palettes

Merge branch 'master' into feature-color-palette

Conflicts:
	src/css/spectrum/spectrum-overrides.css
2014-03-29 18:35:56 +01:00
f2aceedefd Merge pull request #157 from juliandescottes/feature-colorpicker-hexa
Feature colorpicker hexa
2014-03-26 07:51:36 +01:00
173936d74f Force rgb format, remove extra padding 2014-03-26 07:50:37 +01:00
d4f315e0c1 Color Palette : Added popup mgr + palettes list 2014-03-26 07:41:45 +01:00
1f022fd4a7 Enhancement : Add hint to see Keyboard cheatsheet 2014-03-18 01:45:59 +01:00
8581e4ec65 feature : allow user to input hexa for color 2014-03-16 23:41:38 +01:00
903f6817cf feature : allow to delete current selection
* Users can now use DEL to delete the current selection
* Cheatsheet has been updated accordingly
* Cheatsheet has been refactored to mutualize markup creation code
2014-03-16 23:22:47 +01:00
4b608e98a9 Merge pull request #154 from juliandescottes/feature-change-grid-size
Feature change grid size
2014-03-16 22:56:07 +01:00
4b0b1a4bad doc : Updated JS Doc for ImageResizer 2014-03-16 22:53:10 +01:00
9ae01cb074 feature : change grid size
* removed SHOW_GRID boolean, replaced with GRID_WIDTH
* gridEnabled on a frame is now infered from the grid width setting
* updated template to use a select to pick the grid size
2014-03-16 22:46:43 +01:00
c38300392e Updating README.md 2014-03-16 22:09:48 +01:00
3258f0a383 Updating README.md 2014-03-16 21:25:20 +01:00
87574a2b30 Cleanup project root 2014-03-16 21:15:34 +01:00
50e7d05764 Update README.md 2014-03-15 17:00:11 +01:00
b32d0ddcfe Cleanup README.md
Removed old screenshots, added actual information about the project !
2014-03-15 16:59:16 +01:00
f139a9c130 Fix : Drawer was not opening when clicking on text
- SettingsController : event is stopped after click on icon has been
  processed. This way onBodyClick callback is not triggered
2014-03-13 00:22:15 +01:00
087b8c57c5 UI : Align PNG export with GIF export
- PNG export now has its own panel
- Lots of code duplication between PNG and GIF controller => FIXIT
- Added a link displayed after image upload
2014-03-08 17:23:20 +01:00
0072a2c8b0 UI : Use template for drawing tool markup
Switched to templates instead of string concatenation.
Template for drawing tool LI is defined in drawing-tools template
2014-03-05 00:01:47 +01:00
ab401d3013 UI : Add Keyboard shortcuts on tools tooltips 2014-03-04 23:47:56 +01:00
a430d72415 UI : Color of zoom border minimap
Also UI : Position of selected vertical mirror pen icon
2014-03-04 23:42:32 +01:00
47c6261289 Merge pull request #153 from juliandescottes/feature-local-storage
Feature local storage
2014-03-03 23:10:49 +01:00
cac1fa8ed5 UX : Primary/Secondary colors usability
- Added swap colors icon
- Created SVG icon, source is in resources (Inkscape)
2014-03-03 22:50:08 +01:00
b51620634e UI : update display of palette tool icons 2014-02-20 18:26:35 +01:00
2f1e13ca20 Added private rule to gitignore 2014-02-16 22:37:09 +01:00
0f817ddf58 Increased timeout config for Remote build 2014-02-12 00:14:24 +01:00
5d4ba0b79f Added comment 2014-02-12 00:08:52 +01:00
aae994b3d5 Feature : Saved status and warning msg
Added saved status (*) next to title when a Piskel is updated.
Upon saving, the * disappears.

If the workspace contains an unsaved piskel when leaving the application a
message will be displayed to the user, using onbeforeunload.

This logic should also be used everywhere we display a confirm message
before a navigation.
2014-02-11 23:42:38 +01:00
bd0adda73f Various bug fixes
- Added missing files from previous commit
- Fixed move cursor that would remain after using a Selection tool
- Switched to mousedown for Tool Selection to avoid missed clicks
2014-02-11 22:04:44 +01:00
85084b8279 Added localstorage save + read 2014-02-10 01:00:16 +01:00
676bf1c7fd Fix : Settings drawer close usability bug
+ Settings drawer could not be closed when clicking above or below its
container. This has been fixed by changin the logic used for determining
if the click was inside/outside of the Settings drawer.

+ Added DOM utility to compensate for the limitations of JQuery
contains...
2014-02-09 21:49:08 +01:00
c105619605 Merge pull request #152 from juliandescottes/feature-resize-panel
Feature resize panel
2014-02-09 21:14:42 +01:00
0dc5b2bc31 Merge branch 'feature-save-panel' into feature-resize-panel 2014-02-09 21:12:32 +01:00
a31e3570f3 Merge branch 'feature-save-panel' of https://github.com/juliandescottes/piskel into feature-save-panel 2014-02-09 21:10:09 +01:00
e8d96bf73f Fix : added missing Method on BaseSelect
- TODO : Review usage of hideHighlightedPixel in Tools
2014-02-09 20:56:45 +01:00
9fc971f40b Added resize canvas panel 2013-12-24 12:57:03 +01:00
0d2337221c Merge pull request #151 from juliandescottes/feature-save-panel
Feature save panel
2013-12-24 02:52:37 -08:00
fc19695a4a Misc : start frame index at 1 in PreviewFilm 2013-12-24 11:51:41 +01:00
fbdf1aaf9a added loading over + fixed bug with highlighted pixel removal 2013-12-23 15:04:13 +01:00
f98c2d2cf5 Issue#148:JSError when deleting first frame + preview speed accuracy 2013-12-19 00:15:40 +01:00
4056142b97 Issue#145 : Hide highlighted pixel
+ BaseTool : added new method hideHighlightedPixel
+ DrawingController : mousemove event plugged on mousenter
  and unplugged on mouseleave
+ DrawingController : tool.hideHighlightPixel called on mouseleave and
  when switching the current tool to active (i.e. when user starts
  clicking)
2013-12-18 23:37:17 +01:00
e4cf2ac40b Merged 2013-12-18 23:22:25 +01:00
b77f7057d7 save-panel : added piskel descriptor 2013-12-10 21:25:36 +01:00
8b6958bf0b feature:save-panel : reuse textfield css 2013-12-10 21:22:53 +01:00
b11b16b427 initial 2013-12-06 18:04:04 +01:00
cecadf54e1 Merge pull request #144 from juliandescottes/improve-color-selection-ux
Improve color selection ux
2013-12-05 13:14:00 -08:00
e4c14e234e ok this one is chaos 2013-12-05 22:12:48 +01:00
0109eb81dd spectrum modification : add position information top container 2013-11-28 07:40:28 +01:00
167adaceb0 spectrum modification : add position information top container 2013-11-28 07:24:08 +01:00
8cf588b26d Design attempt 2013-11-27 23:46:07 +01:00
75dc1c5944 Design attempt 2013-11-27 23:43:59 +01:00
42862e188d Design attempt 2013-11-27 23:24:03 +01:00
c04a645991 Design attempt 2013-11-26 23:49:55 +01:00
5bbbdf64d9 Merge from master 2013-11-26 21:40:43 +01:00
569f42b7e2 Fix : fire resize event after loading piskel 2013-11-25 22:24:55 +01:00
46b267c2a4 Merge pull request #143 from juliandescottes/add-keyboard-shortcuts
Add keyboard shortcuts
2013-11-24 06:23:47 -08:00
bb9bafd67c Merge pull request #142 from juliandescottes/reduce-piskel-model-size
Reduce piskel model size
2013-11-24 06:18:05 -08:00
11a3155e38 Merge branch 'master' into improve-color-selection-ux 2013-11-23 19:51:47 +01:00
e852fb7c57 Merge with master after PR zoom-level 2013-11-23 19:50:53 +01:00
3de3c3542e Post merge fixes 2013-11-23 19:33:00 +01:00
ce111be5c8 Merging from master after PR zoom level 2013-11-23 19:25:51 +01:00
e88d8fae07 Merge pull request #141 from juliandescottes/zoom-level
Zoom level
2013-11-23 05:21:37 -08:00
f26b1d4ebc improve : color picker : initial implementation using spectrum 2013-11-21 00:44:46 +01:00
2d3bbc73f1 Forgot to add duplicate frame shortcut to cheatsheet 2013-11-20 23:00:47 +01:00
0a05374af5 feature : add keyboard shortcuts
+ added shortcut to create new frames (n)
+ added shortcut to duplicate frame (shift+n)
2013-11-20 22:58:20 +01:00
6eabf01ffc feature : add keyboard shortcuts
+ decentralized shortcut declaration
+ each service/controller is now responsible for declaring its shorcuts
- documentation (cheatsheet) is still to be maintained manually
- init order matters (shortcutService has to be instanciated before
  everyone else) => should have a standalone KeyboardService singleton
  which is ready as soon as it is loaded
2013-11-19 23:46:33 +01:00
9d0f41362b Fix : typo 2013-11-19 08:15:37 +01:00
7d296f3dc3 Fix : add keyboard shortcuts : forgot misc keys 2013-11-19 08:13:16 +01:00
a0273edb3e feature : add keyboard shortcuts
+ cleanup of color management
+ colors are now stored in palette controller
+ drawing controller has a dependency on palette controller
+ UPDATE COLOR events have been removed (they were used only for
synchronizing palette and drawing controller)
2013-11-19 07:40:35 +01:00
e0b76f5329 feature : add keyboard shortcuts : added help panel displayed on shift+? 2013-11-18 23:53:12 +01:00
c033d65cde fix : tool icon not selected when using shortcut 2013-11-17 22:47:21 +01:00
f0ef016309 feature : add keyboard shortcuts : initial impl
+ added shortcuts for all tools in ToolController
+ modified structure of tools in Controller to Array of descriptors to
allow to declare shortcuts directly when setting up the tool controller
2013-11-17 22:07:26 +01:00
25e6470499 feature : add keyboard shortcuts : keycodes
+ moved keycode translation to KeycodeTranslator
+ made KeycodeTranslator more generic to handle 0-9 and a-z keys
+ small refactor in KeyboardEventService
2013-11-17 21:15:53 +01:00
5d83a39cf0 feature : add keyboard shortcuts : Events cleanup
+ Removed unused events
2013-11-17 20:20:27 +01:00
e68ae7f31d feature : zoom level : code review
+ Switched from BITWISE OR 0 (x | 0) to Math.floor for readability
2013-11-15 00:39:43 +01:00
3af64d3f45 feature : zoom level : code review
+ added explanatory comment for CanvasUtils.disableImageSmoothing
+ detect browser for chosing wheel/mousewheel event in DrawingController
+ create ABSTRACT_FUNCTION constant to be reused forabstract methods
2013-11-15 00:32:18 +01:00
86cd1cdeaa fix : reduce piskel model size
+ moved Serializer and Deserializer to utils.serialization package
+ put all backward code in utils.serialization.backward
+ added static method on Deserializer to make its usage similar to other
  utils in the package
- still not happy with the names used in Deserializer classes
  (deserializer.deserialize ...)
2013-11-15 00:03:05 +01:00
4a1a7b6c2b fix : reduce piskel model size : ImportController
+ ImportController is no longer relying on the deserializer to build a
  piskel instance
+ Static builders have been added to Piskel and Layer to help easily
  create new instances from existing elements
2013-11-14 23:03:29 +01:00
e9a2ccfd1d fix : reduce piskel model size : fix import feature 2013-11-13 23:51:27 +01:00
df4978f6af fix : reduce piskel model size
+ piskel deserialization is now clearly asynchronous
+ added utils.Deserializer (not a singleton though, more a builder/loader)
+ utils.Deserializer constructor expects a callback
+ when all layers are loaded and piskel is ready, the callback provided by
  the client is called with piskel as the first argument
- Deserializer doesn't fit in the utils package, which should be reserved
  to singletons : can move it to service as a PiskelLoaderService, and
  Deserializer could remain with only the purely static methods
- ImportController is realying on the Deserializer to build a Piskel but
  it shouldn't. Find a way to mutualize the code necessary to create a
  Piskel from an array of pskl.model.Frame
- still cleanup to do in app.js
- comments to add as well
2013-11-13 23:39:43 +01:00
781abb735b fix : reduce piskel model size
- added backward compatible implementation for v1 models
2013-11-13 22:57:07 +01:00
4f54715f70 fix : reduce piskel model size
- Initial implementation : working but ...
- MODEL_VERSION has been bumped to 2
- The loading process is now theoretically asynchronous (loading images to
  read the content of the layers), but for now, the asynchronous behaviour
  is hidden behind a nasty hack, which is somehow similar to lazy loading.
  When loading the piskel, a Piskel is created synchronously, with fake
  empty frames, and as the images will get loaded, the fake frames will be
  replaced by the actual frames.

  I really don't like this, and the asynchronous nature of the loading
  should be clearly expressed
- There is no backward compatible deserializer for the previous version of
  the model (1)
- The Serializer utils is just badly designed. Serialization and
  deserialization should be splitted into two different classes
- Saving & loading are still done in app.js and should be moved to
  services

BUT : the size of the piskels is now pretty small. A piskel which was
using 890kB previously is now using only 10kB. Although it should be
noted, that after gzip there is no significant difference between this
version and the existing one. The only gains we can really expect with
this are : less disk space used on appengine, ability to reuse the
layers' pngs directly on piskel-website (but to be honest I can't see any
valid use case for this)
2013-11-08 00:44:24 +01:00
c8a8d470a7 renamed all references to dpi to zoom for consistency (also wtf dpi anyway !) 2013-11-05 22:11:47 +01:00
bd030fdf1f Merge branch 'master' into zoom-level 2013-11-05 00:15:08 +01:00
6e1ce724cb feature : zoom level
- fix : removed duplicated code between ImageResizer and CanvasUtils
  (disabledImageSmoothing utility method)
- added pskl.utils.UserAgent, basic user agent sniffer. I need it to sniff
  out IE10 for frame rendering (and it's not possible to feature detect
  here). Can check isChrome, isFirefox, isIE and get the version for each
  of them
- added resizeNearestNeighbour in ImageResizer. Readapted from piskel
  website, this allows us to 1 - resize without AA on IE10, and 2 - add a
  pixel gap to reenable the GRID
- finally : added back support for GRID !
- also extracted the 'zoomed out background color' as a constant in
  Constant.js
2013-11-05 00:05:49 +01:00
2248f41e68 feature : zoom-level
- Fixed bug with layer rendering when moving drawing offset (bad
  redraw-flag checking)
2013-11-02 13:45:41 +01:00
44722ab88e feature : zoom-level
- Fixed bug with layer rendering when moving drawing offset (bad
  redraw-flag checking)
2013-11-02 11:39:35 +01:00
cd4952cc7b feature : zoom-level
- Minimap usability : mouseup and mousemove events are now plugged on
  document.body instead of the minimap's controller. This way the user can
  move his mouse outside the container to keep moving the map's frame.
  Also the mouseup information is no longer lost if it occurs outside for
  the minimap.
2013-11-02 11:24:02 +01:00
eb559eee0c fix : import-picture-panel
- When imported 1 picture and then importing another one, the picture
  preview was not cleaned and was displaying the two images side by side.
  Fixed in ImportController.js
- Switched all double-quoted strings in ImportController to single-quoted
  strings. Should enforce this using jshint
- Aligned all inputs in the import picture panel
- Renamed 'Preview :' import section to 'Info :'. Mostly it's to make it
  shorter, but also I'd like to display additional information to the
  right of the preview in the future.
2013-11-02 11:02:03 +01:00
e0d63bf295 fix : renderer resize on window resize 2013-11-02 00:00:38 +01:00
8a380b6c78 merged from master 2013-11-01 23:37:09 +01:00
5693f34fb9 fix : LocalStorageService deserialization 2013-11-01 23:30:33 +01:00
2ba451d42c Merge pull request #140 from juliandescottes/import-picture-panel
Import picture panel
2013-11-01 15:28:17 -07:00
bd99027852 feature : zoom
- Added MinimapController that displays a frame on the animated preview
  when zoomed in
- Added bounds for the offset to make sure it doesn't go crazy
- Added new utility Math.js with a minmax function
- TODO : the minimap controller has a lot of dependencies, see if could be
  cleaned up
- TODO : DrawingController knows the size of the picture it has to render
  only indirectly, which makes it hard in some cases (such as boundary
  checking performed during setOffset)
2013-11-01 23:11:11 +01:00
68edbe62c7 Forgot 2 files ! 2013-11-01 17:17:41 +01:00
472906957a feature : zoom :
- Extracted layers rendering logic from DrawingController to dedicated
  class
- Turned RendererManager into Composite renderer (extends
  AbstractRenderer)
- AbstractRenderer no longer contains a render(frame) method, implementing
  the render differs too much between my current renderers to impose a
  single signature, but I should improve this later if too much time on ma
  hands
2013-11-01 17:12:59 +01:00
b7e8310b61 feature : zoom : continued
- simplified Renderer(s) architecture (removed decorator,
  CachedFrameRenderer simply inherits from FrameRenderer now)
- keeping AbstractRenderer to act as interface
- fixed issue with layers : forgot to clone the first frame while merging
  and therefore was modifying the original frame when I just wanted to
  create a tmp frame (FrameUtils.js)
- extracted the mousemove throttling delay used in DrawingController to
  Constants.js and reduced it from 40ms to 10ms
2013-11-01 16:27:23 +01:00
51f86afe6e feature : zoom
- Created AbstractRenderer in rendering package
- Created CachedRenderer and CachedFrameRenderer to extract basic frame
  caching logic from DrawingController
- Created RendererManager to synchronize updates made to several Renderer
  settings
- Moved FrameRenderer from pskl.rendering to pskl.rendering.frame
- Fixed the resize of the drawing area when the window is resized
2013-11-01 15:39:42 +01:00
3ce9aaa843 Added utilities for alpha-composition in FrameUtils, for future usage ... maybe 2013-11-01 11:17:50 +01:00
7490651f83 Zoom initial implementation. No UI, only bound to mousewheel. Everything is broken, to amend ! 2013-10-29 22:16:39 +01:00
2f6f0d14e1 Merge branch 'master' into import-picture-panel 2013-10-28 21:58:28 +01:00
a69b83e9bd Fix : layer : duplicateFrame bug 2013-10-28 21:57:59 +01:00
c332aa2dea import-picture-panel : IE10 CSS fix for input text with text-align:right 2013-10-25 00:32:42 +02:00
b2258a668d import-picture-panel : IE10 CSS fix for input text with text-align:right 2013-10-25 00:31:45 +02:00
a0a1fa7bdf Added preview picture. Added a flow : start with only file input enabled 2013-10-23 23:34:09 +02:00
3dde3504d1 Synchronize resize fields, resize image when importing 2013-10-23 01:01:35 +02:00
6c0f54032d Import panel 2013-10-22 07:40:08 +02:00
61419f0bba import panel : before removal of import from URL option 2013-10-21 23:08:12 +02:00
2509ba80a4 intermediary 2013-10-18 08:01:25 +02:00
07cb37f2bf Merge branch 'master' into import-picture-panel 2013-10-16 23:15:09 +02:00
1156008213 Import from file 2013-10-16 23:14:41 +02:00
a8b42a35da import template basic version 2013-10-16 21:43:47 +02:00
721783ce6c Merge pull request #138 from juliandescottes/piskel-website-adaptations
Piskel website adaptations
2013-10-11 11:27:28 -07:00
f549174424 Import panel:
- added pskl.controller.settings.ImportController (empty atm)
- moved SettingsController under settings namespace
- move settings templates in a dedicated folder
- created import icon (svg is in the resources folder)
- added import button in right-layer
2013-10-11 00:04:40 +02:00
4527846ad6 PR138#commitcomment-4293036 use full namespace when specifying a classtype
See https://github.com/juliandescottes/piskel/pull/138#commitcomment-4293036
2013-10-10 13:35:18 +02:00
55e3607ecc Cleanup of saving/loading process 2013-10-10 00:06:11 +02:00
564f74265a Piskel website adaptations :
M CanvasRenderer : can set the color used to represent transparency
M app.js : modified code responsible for saving when in website mode
M PiskelController.js : just some argument renaming
2013-10-08 23:44:06 +02:00
913a50cb28 Merge pull request #129 from juliandescottes/cleanup-cheap-templates
Refactor : moved cheap-templates.js to lib. Added documentation
2013-10-04 15:07:01 -07:00
93ba8c70a0 Merge pull request #130 from juliandescottes/layers-backward-compatibility
Layers:Added backward compatibility for previous models
2013-10-04 15:03:27 -07:00
17a147c880 grrmml 2013-10-04 23:55:45 +02:00
1e99a051e6 Rollback of initialization sequence 2013-10-04 23:46:19 +02:00
894486fba6 Review : fixes 2013-10-04 23:26:53 +02:00
5502d75ca5 Layers:Added backward compatibility for previous models 2013-10-04 22:59:42 +02:00
a87b09908d Refactor : moved cheap-templates.js to lib. Added documentation 2013-10-04 22:25:47 +02:00
09da75af92 Removing external libs from Closure compiler pass 2013-10-02 00:11:03 +02:00
a075a1c8b3 Merge pull request #128 from juliandescottes/feature-gif-export-panel
Feature gif export panel
2013-09-30 15:51:20 -07:00
2686a2e944 Layers:Review:Removed grid drawing routine : was never drawn 2013-09-30 22:44:02 +02:00
f514b6cd10 Layers:Review:Cleanup of GifExportController 2013-09-30 22:00:31 +02:00
7aa407970f Layers:Review:Rename LayersController to LayersListController 2013-09-30 21:22:58 +02:00
64daa05140 Layers:Review:Rename layers.html to layers-list.html 2013-09-30 21:20:40 +02:00
90f2fac2d3 Layers:Minor style changes 2013-09-29 23:33:40 +02:00
b3d1cc5ea6 Layers:Review:Added todos in cheap-templates.js 2013-09-29 23:27:23 +02:00
4eebff804b Layers:Review:Renamed layers-container to layers-list-container. Extracted URLs to Constant.js 2013-09-29 23:26:09 +02:00
76511058d1 Layers:Review:Rename renderers frame up/down to above/below 2013-09-29 23:16:32 +02:00
4f754c6af2 Layers:Review:Changed FrameRenderer className property to classes (array) 2013-09-29 23:14:10 +02:00
17ba93cc9f Layers:Review:Renamed layers canvases css classes to layers-above/below-canvas 2013-09-29 23:05:24 +02:00
bcf34e6e55 Layers:Review:Only one selector per line 2013-09-29 22:53:05 +02:00
82dda463a8 Dev environment : JSHint will raise error if trailing whitespace 2013-09-29 22:50:24 +02:00
b261884d2b Dev environment : Remove globals 2013-09-29 00:06:07 +02:00
87ba28372c Layers : Deleted js/model/Framesheet.js
No longer used
2013-09-29 00:02:21 +02:00
be9238c9b1 Layers : FRAMESHEET_RESET -> PISKEL_RESET
Framesheet no longer exists.
2013-09-29 00:01:18 +02:00
ca427e0853 Dev environment : closure compiler + jshint update
Fixed error raised by closure compiler
Added es3 option to jshint (detect trailing commas)
Added curly option to jshint (missing curly braces for if/for blocks)
Removed trailing whitespaces (not enforced through jshint though)
2013-09-28 23:52:51 +02:00
b254c582b9 Merge branch 'master' into feature-gif-export-panel 2013-09-28 23:37:12 +02:00
80b336aab5 Merge pull request #127 from juliandescottes/closurecompiler
Basic wiring of Closure compiler
2013-09-28 14:32:59 -07:00
948457a3dc Show closure compiler warnings
- Flush JS binary to temporary file instead of STDOUT
 - Flushing to temp file allow display of warnings (mostly our fake
require/provide)
 - gitignore the temp JS file
 - Clean some comments
2013-09-28 21:28:45 +02:00
38dc1dc9fe Closure Compiler: Fix All The things !
- Adding some small fixes to pass compile step (mostly /** instead of
/*).
  - Adding some closure externs
2013-09-28 21:10:12 +02:00
39d9491aff Plug 'compile' on test
Let's break all the thingz !
2013-09-28 19:11:41 +02:00
f3453918c1 Fix typo + plugin compile step in Travis 2013-09-28 19:06:35 +02:00
2f9b75fe5e Experiment closure compiler - should trigger errors
local compiler.jar
should trigger errors on Travis
2013-09-28 18:51:10 +02:00
2df811b647 Layers : fix : Set button height to 24px 2013-09-27 23:19:08 +02:00
1bc73125dc Fix jscolor : add jscolor.install to Palette Controller init sequence. Fix layer canvas update on DPI change 2013-09-26 22:43:45 +02:00
50ca22d91a Clear layers canvas before redraw 2013-09-26 21:53:37 +02:00
3a8d96f840 Arrow icons update 2013-09-26 07:47:11 +02:00
9395be3034 Layers : add layer icon. Position buttons on top of list. Fix name generation issue 2013-09-25 22:43:21 +02:00
ff5f9273a8 Layers container style update 2013-09-25 21:03:57 +02:00
80a9fe3396 First layer UI. Just functional, UX far from ideal 2013-09-25 00:11:12 +02:00
6528c7724b Issue 24 : Layers
!! NOT STABLE !!
Initial implementation. No UI update yet.
Check js/model/Piskel.js and js/model/Layer.js for an overview of the new
API.

Piskels can be saved on the existing service.

Previous piskels cannot be loaded. This should be fixed soon.
2013-09-22 21:02:43 +02:00
4f6863eb8a Gif export panel first draft 2013-09-07 17:50:43 +02:00
069ccb0735 Merge branch 'master' into feature-gif-export-panel 2013-09-07 13:29:57 +02:00
e91f1fc74b Adding loadFramesheet entrypoint for importing pictures 2013-08-15 20:47:50 +02:00
811524f31a Merge branch 'master' into feature-gif-export-panel 2013-08-12 07:37:10 +02:00
d909cec19d Merge pull request #126 from juliandescottes/add-grunt-task-webserver
Add grunt task webserver
2013-08-11 22:34:35 -07:00
628fd1625b Merge branch 'master' into feature-gif-export-panel 2013-08-12 07:32:04 +02:00
73b98850db Added cheap lazy templates + logic to switch between setting controllers 2013-08-12 07:31:09 +02:00
b4d52cfca8 Merge pull request #125 from juliandescottes/propose-use-iframe-cheap-templates
Propose use iframe cheap templates
2013-08-11 14:47:04 -07:00
879358fae4 Merge pull request #117 from juliandescottes/minify-statics
Added concat and uglify tasks to grunt.
2013-08-11 14:39:33 -07:00
5be8f7e7fb Merge pull request #121 from juliandescottes/enhance-gif-encoding-with-gif.js
Enhance gif encoding with gif.js
2013-08-11 11:55:44 -07:00
d8d6f27462 New grunt task : serve 2013-08-11 20:51:04 +02:00
03711869cd removed useless mongoose exe 2013-08-11 20:30:19 +02:00
6a5b3b6849 updating smoke test to parametrize delay 2013-08-11 20:09:43 +02:00
b3953ea9db adding precommit hook to source control 2013-08-11 20:07:45 +02:00
fd2907cfde Testing pre-commit hook 2013-08-11 13:37:23 +02:00
2e3ddd6ed1 Updating list name in index.html as well. Also fixed indentation in smoke_test.js 2013-08-11 10:45:56 +02:00
750f2fb7b5 darn it man, forgot to update Gruntfile.js with the new script list filename. 2013-08-11 10:31:24 +02:00
9ef22f646e removed renamed script-load-list.js and rolled back useless change in js/Constants.js 2013-08-11 10:04:35 +02:00
2299f35977 Introducing iframe based templates 2013-08-11 01:26:38 +02:00
36c247cb04 Worker blob loader is not working on IE ... 2013-08-11 01:25:18 +02:00
e6080c781b Preload worker in a blob to avoid any subsequent call to server 2013-08-10 18:06:57 +02:00
39287e3400 Switched to gif.js library. It's awesome 1 2013-08-10 17:35:36 +02:00
c23de31e07 Merge from master + bugfixing on b64 2013-08-10 14:47:26 +02:00
509571314a Merge pull request #118 from juliandescottes/fix-size-bugs
Fixed size related issues. Selection Manager no longer depends on the fr...
2013-08-10 05:30:12 -07:00
f468790baa Merge from master + added more jshint checks (undef and latedef). Very helpful to catch post merge issues. 2013-08-10 14:28:10 +02:00
0c2cdc02ae Merge pull request #120 from juliandescottes/add-grunt-leading-indent
Dev environment:force indentation to 2 spaces.
2013-08-10 03:23:28 -07:00
87a68bfe21 Dev environment:force indentation to 2 spaces. Added new grunt module, grunt-leading-indent to check space consistency, and modified jshint options to enforce 2 spaces 2013-08-10 12:11:16 +02:00
dc557bdba8 Fixed png preview orientation when saving 2013-08-06 23:38:56 +02:00
2deaf00911 Additional fix to be inline with what APP Engine expects 2013-08-05 23:57:51 +02:00
21172249a3 Added fix for PreviewFilmController for very big piskels : limit DPI to 1 2013-08-05 23:55:19 +02:00
1977141076 Fixed size related issues. Selection Manager no longer depends on the frameoverlay which is now only manipulated by the tools 2013-08-05 23:34:11 +02:00
b42f896584 Adaptations for APP Engine compatibility 2013-08-04 22:15:45 +02:00
02e261880a Removing built files again 2013-08-04 21:55:47 +02:00
f89cb8146d Trying to get the travis build to pass 2013-08-04 21:47:17 +02:00
54ea427dce Trying to get the travis build to pass 2013-08-04 21:37:07 +02:00
a16e1bab09 added Function.prototype.bind polyfill for PhantomJS. Make Casper happy. 2013-08-04 21:20:25 +02:00
8acd91b4d9 updated smoke test URL to point to debug version 2013-08-04 18:36:43 +02:00
91bacd1dd9 Added concat and uglify tasks to grunt. Piskel on master will only be able to work in debug mode, by passing ?debug in URL. The minified version is built in /build, which has been added to .gitignore 2013-08-04 18:27:32 +02:00
702 changed files with 44987 additions and 6759 deletions

25
.codeclimate.yml Normal file
View File

@ -0,0 +1,25 @@
engines:
csslint:
enabled: true
duplication:
enabled: true
config:
languages:
- javascript
eslint:
enabled: true
checks:
wrap-iife:
enabled: false
fixme:
enabled: true
ratings:
paths:
- "**.css"
- "**.js"
exclude_paths:
- .github/
- bin/
- misc/
- src/js/lib/
- test/

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
# Exclude libs.
**/lib/**/*.js

19
.github/ISSUE_TEMPLATE vendored Normal file
View File

@ -0,0 +1,19 @@
Bug description
(this template is intended for bug reports, erase it when requesting features/enhancements)
### Steps to reproduce the bug
1. go to piskelapp.com
2. select a tool
3. ...
### Environment details
* operating system:
* browser (or offline application version):
### Sprite details
* number of frames:
* sprite resolution:
* session duration:
Feel free to include a screenshot of the bug, a .piskel file of the sprite or anything else that can help us investigate.

32
.gitignore vendored
View File

@ -1,12 +1,40 @@
# mac artefacts
# mac artifacts
*.DS_Store
# nodejs local installs
node_modules
npm-debug.log
# node webkit cache
cache
# sublime text stuff (the -project should actually be shared, but then we'd have to share the same disk location)
*.sublime-project
*.sublime-workspace
# netbeans project folder
nbproject
# vscode workspace folder
.vscode
# git stackdumps
*.stackdump
*.stackdump
# diffs
diff.txt
# build destination
dest
build/closure/closure_compiled_binary.js
# spriting artifacts
src/img/icons.png
src/img/icons@2x.png
src/css/icons.css
# plato report directory
report
# marked as private
*.private.*

3
.npmignore Normal file
View File

@ -0,0 +1,3 @@
node_modules/
test/

View File

@ -1,13 +1,10 @@
language: node_js
node_js:
- 0.8
- "7.4.0"
before_install:
- npm update -g npm
- npm install -g grunt-cli
- git clone git://github.com/n1k0/casperjs.git ~/casperjs
- cd ~/casperjs
- git checkout tags/1.0.2
- export PATH=$PATH:`pwd`/bin
- cd -
before_script:
- phantomjs --version
- casperjs --version
sudo: false

View File

@ -1,60 +1,358 @@
/**
* How to run grunt tasks:
* - At project root, run 'npm install' - It will install nodedependencies declared in package,json in <root>/.node_modules
* - install grunt CLI tools globally, run 'npm install -g grunt-cli'
* - run a grunt target defined in Gruntfiles.js, ex: 'grunt lint'
*
* Note: The 'ghost' grunt task have special deps on CasperJS and phantomjs.
* For now, It's configured to run only on TravisCI where these deps are
* correctly defined.
* If you run this task locally, it may require some env set up first.
*/
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
/*options: {
"evil": true,
"asi": true,
"smarttabs": true,
"eqnull": true
},*/
files: [
'Gruntfile.js',
'package.json',
'js/**/*.js',
'!js/lib/**/*.js' // Exclude lib folder (note the leading !)
]
},
connect: {
www: {
options: {
base: '.',
port: 4545
}
}
},
ghost: {
dist: {
filesSrc: ['tests/integration/casperjs/*_test.js'],
options: {
args: {
baseUrl: 'http://localhost:' +
'<%= connect.www.options.port %>/'
},
direct: false,
logLevel: 'error',
printCommand: false,
printFilePaths: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-ghost');
// Update this variable if you don't want or can't serve on localhost
var hostname = 'localhost';
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('test', ['jshint', 'connect', 'ghost']);
var PORT = {
PROD : 9001,
DEV : 9901,
TEST : 9991
};
// create a version based on the build timestamp
var dateFormat = require('dateformat');
var version = '-' + dateFormat(new Date(), "yyyy-mm-dd-hh-MM");
var releaseVersion = require('./package.json').version;
/**
* Helper to prefix all strings in provided array with the provided path
*/
var prefixPaths = function (paths, prefix) {
return paths.map(function (path) {
return prefix + path;
});
};
// get the list of scripts paths to include
var scriptPaths = require('./src/piskel-script-list.js').scripts;
var piskelScripts = prefixPaths(scriptPaths, "src/").filter(function (path) {
return path.indexOf('devtools') === -1;
});
// get the list of styles paths to include
var stylePaths = require('./src/piskel-style-list.js').styles;
var piskelStyles = prefixPaths(stylePaths, "src/");
// Casper JS tests
var casperjsOptions = [
'--baseUrl=http://' + hostname + ':' + PORT.TEST,
'--mode=?debug',
'--verbose=false',
'--includes=test/casperjs/integration/include.js',
'--log-level=info',
'--print-command=false',
'--print-file-paths=true',
];
var integrationTestPaths = require('./test/casperjs/integration/IntegrationSuite.js').tests;
var integrationTests = prefixPaths(integrationTestPaths, "test/casperjs/integration/");
var getConnectConfig = function (base, port, host) {
if (typeof base === 'string') {
base = [base];
}
return {
options: {
port: port,
hostname : host,
base: base
}
};
};
// load all grunt tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
clean: {
all: ['dest', 'src/img/icons.png', 'src/css/icons.css'],
prod: ['dest/prod', 'dest/tmp'],
desktop: ['dest/desktop', 'dest/tmp'],
dev: ['dest/dev', 'dest/tmp']
},
/**
* STYLE CHECKS
*/
leadingIndent : {
options: {
indentation : "spaces"
},
css : ['src/css/**/*.css']
},
eslint: {
files: [
// Includes
'src/js/**/*.js',
// Exludes
// TODO: remove this (for now we still get warnings from the lib folder)
'!src/js/**/lib/**/*.js'
]
},
/**
* SERVERS, BROWSER LAUNCHERS
*/
connect: {
prod: getConnectConfig('dest/prod', PORT.PROD, hostname),
test: getConnectConfig(['dest/dev', 'test'], PORT.TEST, hostname),
dev: getConnectConfig(['dest/dev', 'test'], PORT.DEV, hostname)
},
open : {
prod : {
path : 'http://' + hostname + ':' + PORT.PROD + '/'
},
dev : {
path : 'http://' + hostname + ':' + PORT.DEV + '/?debug'
}
},
watch: {
prod: {
files: ['src/**/*.*'],
tasks: ['build'],
options: {
spawn: false
}
},
dev: {
files: ['src/**/*.*'],
tasks: ['build-dev'],
options: {
spawn: false
}
}
},
/**
* BUILD STEPS
*/
sprite:{
all : {
src: 'src/img/icons/**/*.png',
retinaSrcFilter: 'src/img/icons/**/*@2x.png',
dest: 'src/img/icons.png',
retinaDest: 'src/img/icons@2x.png',
destCss: 'src/css/icons.css'
}
},
concat : {
js : {
options : {
separator : ';'
},
src : piskelScripts,
dest : 'dest/prod/js/piskel-packaged' + version + '.js'
},
css : {
src : piskelStyles,
dest : 'dest/tmp/css/piskel-style-packaged' + version + '.css'
}
},
uglify : {
options : {
mangle : true
},
js : {
files : {
'dest/tmp/js/piskel-packaged-min.js' : ['dest/prod/js/piskel-packaged' + version + '.js']
}
}
},
includereplace: {
all: {
src: 'src/index.html',
dest: 'dest/tmp/index.html',
options : {
globals : {
'version' : version,
'releaseVersion' : releaseVersion
}
}
}
},
replace: {
// main-partial.html is used when embedded in piskelapp.com
mainPartial: {
options: {
patterns: [{
match: /^(.|[\r\n])*<!--body-main-start-->/,
replacement: "{% raw %}",
description : "Remove everything before body-main-start comment"
},{
match: /<!--body-main-end-->(.|[\r\n])*$/,
replacement: "{% endraw %}",
description : "Remove everything after body-main-end comment"
},{
match: /([\r\n]) /g,
replacement: "$1",
description : "Decrease indentation by one"
}
]
},
files: [
// src/index.html should already have been moved by the includereplace task
{src: ['dest/tmp/index.html'], dest: 'dest/prod/piskelapp-partials/main-partial.html'}
]
},
css: {
options: {
patterns: [{
match: /var\(--highlight-color\)/g,
replacement: "gold",
}]
},
files: [{
src: ['dest/tmp/css/piskel-style-packaged' + version + '.css'],
dest: 'dest/prod/css/piskel-style-packaged' + version + '.css'
}]
}
},
copy: {
prod: {
files: [
// dest/js/piskel-packaged-min.js should have been created by the uglify task
{src: ['dest/tmp/js/piskel-packaged-min.js'], dest: 'dest/prod/js/piskel-packaged-min' + version + '.js'},
{src: ['dest/tmp/index.html'], dest: 'dest/prod/index.html'},
{src: ['src/logo.png'], dest: 'dest/prod/logo.png'},
{src: ['src/js/lib/gif/gif.ie.worker.js'], dest: 'dest/prod/js/lib/gif/gif.ie.worker.js'},
{expand: true, src: ['img/**'], cwd: 'src/', dest: 'dest/prod/', filter: 'isFile'},
{expand: true, src: ['css/fonts/**'], cwd: 'src/', dest: 'dest/prod/', filter: 'isFile'}
]
},
dev: {
files: [
// in dev copy everything to dest/dev
{src: ['dest/tmp/index.html'], dest: 'dest/dev/index.html'},
{src: ['src/piskel-script-list.js'], dest: 'dest/dev/piskel-script-list.js'},
{src: ['src/piskel-style-list.js'], dest: 'dest/dev/piskel-style-list.js'},
{expand: true, src: ['js/**'], cwd: 'src/', dest: 'dest/dev/', filter: 'isFile'},
{expand: true, src: ['css/**'], cwd: 'src/', dest: 'dest/dev/', filter: 'isFile'},
{expand: true, src: ['img/**'], cwd: 'src/', dest: 'dest/dev/', filter: 'isFile'},
]
}
},
/**
* TESTING
*/
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
casperjs : {
drawing : {
files : {
src: ['test/casperjs/DrawingTest.js']
},
options : {
casperjsOptions: casperjsOptions
}
},
integration : {
files : {
src: integrationTests
},
options : {
casperjsOptions: casperjsOptions
}
}
},
/**
* DESKTOP BUILDS
*/
nwjs: {
windows : {
options: {
downloadUrl: 'https://dl.nwjs.io/',
version : "0.19.4",
build_dir: './dest/desktop/', // destination folder of releases.
win: true,
linux32: true,
linux64: true,
flavor: "normal",
},
src: ['./dest/prod/**/*', "./package.json", "!./dest/desktop/"]
},
macos : {
options: {
downloadUrl: 'https://dl.nwjs.io/',
osx64: true,
version : "0.19.4",
build_dir: './dest/desktop/',
flavor: "normal",
},
src: ['./dest/prod/**/*', "./package.json", "!./dest/desktop/"]
},
macos_old : {
options: {
downloadUrl: 'https://dl.nwjs.io/',
osx64: true,
version : "0.12.3",
build_dir: './dest/desktop/old',
flavor: "normal",
},
src: ['./dest/prod/**/*', "./package.json", "!./dest/desktop/"]
}
}
});
// TEST TASKS
// Run linting
grunt.registerTask('lint', ['eslint', 'leadingIndent:css']);
// Run unit-tests
grunt.registerTask('unit-test', ['karma']);
// Run integration tests
grunt.registerTask('integration-test', ['build-dev', 'connect:test', 'casperjs:integration']);
// Run drawing tests
grunt.registerTask('drawing-test', ['build-dev', 'connect:test', 'casperjs:drawing']);
// Run linting, unit tests, drawing tests and integration tests
grunt.registerTask('test', ['lint', 'unit-test', 'build-dev', 'connect:test', 'casperjs:drawing', 'casperjs:integration']);
// Run the tests, even if the linting fails
grunt.registerTask('test-nolint', ['unit-test', 'build-dev', 'connect:test', 'casperjs:drawing', 'casperjs:integration']);
// Used by optional precommit hook
grunt.registerTask('precommit', ['test']);
// BUILD TASKS
grunt.registerTask('build-index.html', ['includereplace']);
grunt.registerTask('merge-statics', ['concat:js', 'concat:css', 'uglify']);
grunt.registerTask('build', ['clean:prod', 'sprite', 'merge-statics', 'build-index.html', 'replace:mainPartial', 'replace:css', 'copy:prod']);
grunt.registerTask('build-dev', ['clean:dev', 'sprite', 'build-index.html', 'copy:dev']);
grunt.registerTask('desktop', ['clean:desktop', 'default', 'nwjs:windows']);
grunt.registerTask('desktop-mac', ['clean:desktop', 'default', 'nwjs:macos']);
grunt.registerTask('desktop-mac-old', ['clean:desktop', 'default', 'replace:desktop', 'nwjs:macos_old']);
// SERVER TASKS
// Start webserver and watch for changes
grunt.registerTask('serve', ['build', 'connect:prod', 'open:prod', 'watch:prod']);
// Start webserver on src folder, in debug mode
grunt.registerTask('play', ['build-dev', 'connect:dev', 'open:dev', 'watch:dev']);
// ALIASES, kept for backward compatibility
grunt.registerTask('serve-debug', ['play']);
grunt.registerTask('serve-dev', ['play']);
grunt.registerTask('test-travis', ['test']);
grunt.registerTask('test-local', ['test']);
// Default task
grunt.registerTask('default', ['lint', 'build']);
};

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

101
README.md
View File

@ -1,70 +1,71 @@
Piskel
======
The goal is to create an easy-to-use/in-the-cloud/web-based 2d animation editor.
[![Travis Status](https://api.travis-ci.org/piskelapp/piskel.png?branch=master)](https://travis-ci.org/piskelapp/piskel) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/)
Try it at : http://juliandescottes.github.com/piskel/
Piskel is an easy-to-use sprite editor. It can be used to create game sprites, animations, pixel-art...
It is the editor used in **[piskelapp.com](http://piskelapp.com)**.
29 May 2013
-----------------------------------
Trying to wake up after a big 8 months nap.
<img
src="https://screenletstore.appspot.com/img/95aaa0f0-37a4-11e7-a652-7b8128ce3e3b.png"
title="Piskel editor screenshot"
width="500">
![nap](http://screenletstore.appspot.com/img/68e1690f-c8a3-11e2-a431-13a291e88f09.gif)
## About Piskel
Also, new features :
* color picker : ![color picker](http://screenletstore.appspot.com/img/18e24a63-c8a4-11e2-b479-13a291e88f09.png)
* create an animated GIF from your piskel (uses jsgif, results may vary ...)
### Built with
16 Sep 2012
------------------------------------
Just a quick update to post a new screenshot. @grosbouddha is delivering features so fast, it's hard to keep up !
The Piskel editor is purely built in **JavaScript, HTML and CSS**.
![Screenshot 4](https://dl.dropbox.com/u/17803671/screen_piskel_4.png "Screenshot 4")
We also use the following **libraries** :
* [spectrum](https://github.com/bgrins/spectrum) : awesome standalone colorpicker
* [gifjs](http://jnordberg.github.io/gif.js/) : generate animated GIFs in javascript, using webworkers
* [supergif](https://github.com/buzzfeed/libgif-js) : modified version of SuperGif to parse and import GIFs
* [jszip](https://github.com/Stuk/jszip) : create, read and edit .zip files with Javascript
* [canvas-toBlob](https://github.com/eligrey/canvas-toBlob.js/) : shim for canvas toBlob
* [jquery](http://jquery.com/) : used sporadically in the application
* [bootstrap-tooltip](http://getbootstrap.com/javascript/#tooltips) : nice tooltips
15 Sep 2012
------------------------------------
2 weeks already since the last README.md update, and so many changes ! There has been a continuous stream of features added to piskel by @grosboudda, @captainbrosset (thanks guys) and myself.
I can't list everything here but quickly
* __Tools__ : in addition to the regular Pen, you can now draw Rectangles, Circles. You can move stuff, copy, paste !
* __Undo/redo__ : you can now cancel your actions using ctrl-z/ctrl-y
* __Drag and drop__ : move frames around in your framesheet, using drag and drop
As well as some **icons** from the [Noun Project](http://thenounproject.com/) :
* Folder by Simple Icons from The Noun Project
* (and probably one or two others)
And a screenshot, for the record :
### Browser Support
![Screenshot 3](https://dl.dropbox.com/u/17803671/screen_piskel_3.png "Screenshot 3")
Piskel supports the following browsers:
* **Chrome** (latest)
* **Firefox** (latest)
* **Edge** (latest)
* **Internet Explorer** 11
30 Aug 2012
------------------------------------
Many new features in 2 days :
* __save animations__, they are persisted in the cloud, and can be retrieved via a __unique URL__
* __color picker__, no longer limited to black and white
* __local storage__, your work is automatically backed up locally
* __color palette__, listing all the colors already used in the animation
* __slider__ for choosing the speed of the preview
### Mobile/Tablets
UI was slightly updated :
There is no support for mobile.
![Screenshot 2](https://dl.dropbox.com/u/17803671/screen_piskel_2.png "Screenshot 2")
### Offline builds
28 Aug 2012
------------------------------------
Thanks to grosbouddha, new features added to Piskel :
* modify preview speed !
* remove frames
* transparent background
Offline builds are available. More details in the [dedicated wiki page](https://github.com/piskelapp/piskel/wiki/Desktop-applications).
24 Aug 2012 (aka the thing I did last night)
------------------------------------
* create small animations in __black__ (left click) and __white__ (right click)
* and actually animations are always in __32x32__ zoomed 10 times
* you can __not even save them__ !
* add new frames for your animation
* do small __ridiculous__ characters
## Contributing ?
Looks like this :
![Alt text](https://dl.dropbox.com/u/17803671/screen_piskel.png "Optional title")
Help is always welcome !
**On the left**, the list of frames for the animation.
**In the 'middle'**, the editable canvas.
**On the right**, the LIVE-ANIMATED-PREVIEW (rocket science stuff going on here).
* **Issues** : Found a problem when using the application, want to request a feature, [open an issue](https://github.com/piskelapp/piskel/issues).
* **Development** : Have a look at the [wiki](https://github.com/piskelapp/piskel/wiki) to set up the development environment
## License
Copyright 2017 Julian Descottes
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,39 +0,0 @@
<!doctype html5>
<html>
<head>
<title>All piskels</title>
</head>
<body>
<script type="text/javascript">
(function () {
var loadAllPiskelIds = function (frameId) {
var xhr = new XMLHttpRequest();
// TODO: Change frameId to framesheetId on the backend
xhr.open('GET', 'http://2.piskel-app.appspot.com/all?l=' + frameId, true);
xhr.responseType = 'text';
xhr.onload = function(e) {
var ul = document.createElement("UL");
var innerHTML = "";
eval("var responseObject = " + this.responseText);
var keys = responseObject.keys;
var baseUrl = window.location.origin + "/piskel/?frameId=";
if (keys) {
for (var i = 0 ; i < keys.length ; i++) {
var key = keys[i];
innerHTML += "<li><a target='_blank' href='"+baseUrl+key+"'>"+key+"</a></li>"
}
}
ul.innerHTML = innerHTML;
document.body.appendChild(ul);
};
xhr.send();
};
loadAllPiskelIds();
})();
</script>
</body>
</html>

View File

@ -0,0 +1,84 @@
const rmdir = require('rmdir');
const path = require('path');
const fs = require('fs');
const fse = require('fs-extra');
const PISKEL_PATH = path.resolve(__dirname, '..');
const PISKELAPP_PATH = path.resolve(__dirname, '../../piskel-website');
var pjson = require('../package.json');
// Callbacks sorted by call sequence.
function onCopy(err) {
if (err) {
console.error('Failed to copy static files...');
return console.error(err);
}
console.log('Copied static files to piskel-website...');
let previousPartialPath = path.resolve(PISKELAPP_PATH, 'templates/editor/main-partial.html');
fs.access(previousPartialPath, fs.constants.F_OK, function (err) {
if (err) {
// File does not exit, call next step directly.
console.error('Previous main partial doesn\'t exist yet.');
onDeletePreviousPartial();
} else {
// File exists, try to delete it before moving on.
fs.unlink(previousPartialPath, onDeletePreviousPartial);
}
})
}
function onDeletePreviousPartial(err) {
if (err) {
console.error('Failed to delete previous main partial...');
return console.error(err);
}
console.log('Previous main partial deleted...');
fse.copy(
path.resolve(PISKELAPP_PATH, "static/editor/piskelapp-partials/main-partial.html"),
path.resolve(PISKELAPP_PATH, "templates/editor/main-partial.html"),
onCopyNewPartial
);
}
function onCopyNewPartial(err) {
if (err) {
console.error('Failed to delete previous main partial...');
return console.error(err);
}
console.log('Main partial copied...');
rmdir(
path.resolve(PISKELAPP_PATH, "static/editor/piskelapp-partials/"),
onDeleteTempPartial
);
}
function onDeleteTempPartial(err) {
if (err) {
console.error('Failed to delete temporary main partial...');
return console.error(err);
}
console.log('Temporary main partial deleted...');
fs.writeFile(path.resolve(PISKELAPP_PATH, "static/editor/VERSION"), pjson.version, onVersionFileCreated);
}
function onVersionFileCreated(err) {
if (err) {
console.error('Failed to create temporary main partial...');
return console.error(err);
}
console.log('Version file created...');
console.log('Finished!');
}
fse.copy(
path.resolve(PISKEL_PATH, "dest/prod"),
path.resolve(PISKELAPP_PATH, "static/editor"),
onCopy
);

View File

@ -1,309 +0,0 @@
body {
background: radial-gradient(circle, #000, #373737);
/* 16/06/2013 : -webkit still needed for
safari, safari mobile and android browser and chrome for android
cf http://caniuse.com/css-gradients */
background: -webkit-radial-gradient(circle, #000, #373737);
}
/**
* Application layout
*/
.main-wrapper {
position: absolute;
top: 5px;
right: 0;
bottom: 5px;
left: 0;
}
.column-wrapper {
text-align: center;
font-size: 0;
position: absolute;
left: 100px; /* Reserve room for tools on the left edge of the screen. */
top: 0;
right: 50px; /* Reserve room for actions on the right edge of the screen. */
bottom: 0;
}
.piskel-name-container {
overflow:hidden;
position:fixed;
top:10px;
left:10px;
color:white;
font-family:Tahoma;
z-index: 10000;
}
.piskel-name-container #piskel-name {
border :none;
color : lightgrey;
background: transparent;
font-size:16pt;
}
.column {
display: inline-block;
}
.left-column {
vertical-align: top;
height: 100%;
margin-right: 7px;
}
.main-column {
height: 100%;
position: relative;
}
.right-column {
vertical-align: top;
margin-left: 10px;
}
.drawing-canvas-container {
font-size: 0;
}
.sticky-section {
position: fixed;
top: 0;
bottom: 0;
z-index: 1000;
}
.sticky-section .sticky-section-wrap {
display: table;
height: 100%;
}
.sticky-section .vertical-centerer {
display: table-cell;
vertical-align: middle;
}
.left-sticky-section.sticky-section {
left: 0;
max-width: 100px;
}
.left-sticky-section .tool-icon {
float: left;
}
.right-sticky-section.sticky-section {
right: 0;
width: 47px;
-webkit-transition: all 200ms ease-out;
-moz-transition: all 200ms ease-out;
-ms-transition: all 200ms ease-out;
transition: all 200ms ease-out;
}
.right-sticky-section .tool-icon {
float: right;
margin-right: 0;
}
.drawer {
}
.drawer-content {
overflow: hidden;
background-color: #444;
height: 550px;
max-height: 100%;
width: 280px;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
/** Righty sticky drawer expanded state. */
.right-sticky-section.expanded {
right: 280px;
}
.right-sticky-section.expanded .tool-icon {
margin-right: 1px;
}
.right-sticky-section .tool-icon.has-expanded-drawer {
position: relative;
background-color: #444;
margin-right: 0;
padding-right: 1px;
}
.settings-section {
margin: 10px 20px;
font-size: 12px;
font-weight: bold;
color: #ccc;
text-shadow: 1px 1px #000;
}
.settings-title {
margin-top: 20px;
margin-bottom: 10px;
text-transform: uppercase;
border-bottom: 1px #aaa solid;
padding-bottom: 5px;
}
.settings-item {}
.background-picker-wrapper {
overflow: hidden;
padding: 10px 5px 20px 5px;
}
.background-picker {
cursor: pointer;
float: left;
height: 35px;
width: 35px;
background-color: transparent;
margin-right: 15px;
padding: 1px;
position: relative;
}
.background-picker:after {
content: " ";
position: absolute;
top: -2px;
right: -2px;
bottom: -2px;
left: -2px;
}
.background-picker:hover:after {
border: #eee 1px solid;
}
.background-picker.selected:after {
border: gold 1px solid;
}
/**
* Canvases layout
*/
.canvas {
position: relative;
z-index: 1;
}
.canvas-container {
position: relative;
display: block;
}
.canvas-container .canvas-background {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.light-picker-background,
.light-canvas-background .canvas-background {
background: url(../img/canvas_background/light_canvas_background.png) repeat;
}
.medium-picker-background,
.medium-canvas-background .canvas-background {
background: url(../img/canvas_background/medium_canvas_background.png) repeat;
}
.lowcont-medium-picker-background,
.lowcont-medium-canvas-background .canvas-background {
background: url(../img/canvas_background/lowcont_medium_canvas_background.png) repeat;
}
.lowcont-dark-picker-background,
.lowcont-dark-canvas-background .canvas-background {
background: url(../img/canvas_background/lowcont_dark_canvas_background.png) repeat;
}
.canvas.canvas-overlay {
position: absolute;
top: 0;
left: 0;
z-index: 10;
}
/**
* Animated preview styles.
*/
.preview-container {
border : 0px Solid black;
border-radius:5px 0px 0px 5px;
box-shadow : 0px 0px 2px rgba(0,0,0,0.2);
font-size: 0;
}
.preview-container canvas {
border : 0px Solid transparent;
}
.display-fps {
float: left;
color: #aaa;
font-size: 12px;
min-width: 55px;
vertical-align: bottom;
line-height: 24px;
}
.range-fps {
overflow: hidden;
}
/**
* User messages
*/
.user-message {
position: absolute;
right: 0;
bottom: 0;
background-color: #F9EDBE;
padding: 10px 47px;
border-top-left-radius: 7px;
color: #222;
border: #F0C36D 1px solid;
border-right: 0;
border-bottom: 0;
font-weight: bold;
font-size: 13px;
z-index: 10000;
max-width: 300px;
}
.user-message .close {
position: absolute;
top: 6px;
right: 17px;
color: gray;
font-weight: bold;
cursor: pointer;
font-size: 18px;
}
.user-message .close:hover {
color: black;
}

View File

@ -1,223 +0,0 @@
.tools-wrapper,
.options-wrapper,
.palette-wrapper {
float: left;
}
.tool-icon {
cursor : pointer;
width: 46px;
height: 46px;
margin: 1px;
background-color: #3a3a3a;
background-repeat: no-repeat;
background-position: 12px 12px;
background-size: 24px 24px;
}
.tool-icon.selected {
cursor: default;
background-color: #444;
cursor: normal;
border: 1px gold solid;
margin: 0;
}
.tool-icon:hover {
background-color: #444;
}
/*
* Tool icons:
*/
.tool-icon.tool-pen {
background-image: url(../img/tools/pen.png);
}
.tool-icon.tool-vertical-mirror-pen {
background-image: url(../img/tools/mirror.png);
background-position: 0px 10px;
background-size: 38px 27px;
}
.tool-icon.tool-paint-bucket {
background-image: url(../img/tools/paintbucket.png);
}
.tool-icon.tool-eraser {
background-image: url(../img/tools/eraser.png);
}
.tool-icon.tool-stroke {
background-image: url(../img/tools/stroke.png);
}
.tool-icon.tool-rectangle {
background-image: url(../img/tools/rectangle.png);
background-position: 12px 14px;
background-size: 24px 20px;
}
.tool-icon.tool-circle {
background-image: url(../img/tools/circle.png);
}
.tool-icon.tool-move {
background-image: url(../img/tools/hand.png);
background-position: 12px 12px;
background-size: 24px 24px;
}
.tool-icon.tool-rectangle-select {
background-image: url(../img/tools/rectangle_selection.png);
background-position: 12px 14px;
background-size: 24px 20px;
}
.tool-icon.tool-shape-select {
background-image: url(../img/tools/magicwand.png);
}
.tool-icon.tool-colorpicker {
background-image: url(../img/tools/eyedropper.png);
background-position: 12px 12px;
background-size: 23px 23px;
}
/*
* Tool cursors:
*/
.tool-paint-bucket .drawing-canvas-container:hover {
cursor: url(../img/icons/paint-bucket.png) 12 12, pointer;
}
.tool-vertical-mirror-pen .drawing-canvas-container:hover {
cursor: url(../img/icons/vertical-mirror-pen.png) 5 15, pointer;
}
.tool-pen .drawing-canvas-container:hover {
cursor: url(../img/icons/pen.png) 0 15, pointer;
}
.tool-eraser .drawing-canvas-container:hover {
cursor: url(../img/icons/eraser.png) 0 15, pointer;
}
.tool-stroke .drawing-canvas-container:hover {
cursor: url(../img/icons/pen.png) 0 15, pointer;
}
.tool-rectangle .drawing-canvas-container:hover {
cursor: url(../img/icons/rectangle.png) 0 15, pointer;
}
.tool-circle .drawing-canvas-container:hover {
cursor: url(../img/icons/circle.png) 2 15, pointer;
}
.tool-move .drawing-canvas-container:hover {
cursor: url(../img/icons/hand.png) 15 15, pointer;
}
.tool-rectangle-select .drawing-canvas-container:hover {
cursor: url(../img/icons/select.png) 15 15, pointer;
}
.tool-shape-select .drawing-canvas-container:hover {
cursor: url(../img/icons/wand.png) 15 15, pointer;
}
.tool-colorpicker .drawing-canvas-container:hover {
cursor: url(../img/icons/dropper.png) 0 15, pointer;
}
.tool-color-picker input {
width: 16px;
height: 16px;
text-indent: -10000px;
border: 1px solid black;
background: white;
cursor: pointer;
position : relative;
top: 10px;
margin-left: 2px;
}
.tool-color-picker .secondary-color-picker {
top : 18px;
margin-left: 0;
}
.palette .palette-color.transparent-color {
position: relative;
top: 10px;
left: 10px;
background-color: white;
height : 16px;
width : 16px;
border: 2px solid #000;
background-size: 16px 16px;
background-position: 0 0;
background-image: -webkit-gradient(
linear,
left top,
right bottom,
color-stop(0, #fff),
color-stop(0.45, #fff),
color-stop(0.5, #ff0000),
color-stop(0.55, #fff),
color-stop(1, #fff)
);
background-image: -moz-linear-gradient(
left top,
#fff 0%,
#fff 45%,
#f00 50%,
#fff 55%,
#fff 100%
);
}
/*
* Framesheet level actions:
*/
.tool-icon.gallery-icon {
background-image: url(../img/gallery.png);
background-position: 3px 3px;
background-size: 39px 39px;
}
.tool-icon.save-icon {
background-image: url(../img/save.png);
background-position: 6px 6px;
background-size: 36px 36px;
}
.tool-icon.gear-icon {
background-image: url(../img/gear.png);
background-position: 6px 7px;
background-size: 32px 32px;
}
.tool-icon.upload-cloud-icon {
background-image: url(../img/cloud_export.png);
background-position: 4px 0px;
background-size: 36px 36px;
position: relative;
}
.upload-cloud-icon .label {
position: absolute;
left: 0;
bottom: 4px;
right: 0;
font-size: 11px;
text-transform: uppercase;
color: #fff;
text-align: center;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,188 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Piskel</title>
<meta name="description" content="">
<meta name="author" content="Julian Descottes">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/tools.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap-tooltip-custom.css">
<link rel="stylesheet" type="text/css" href="css/preview-film-section.css">
</head>
<body>
<div class="piskel-name-container">
<input readonly id="piskel-name" type="text" value=""/>
</div>
<div id="main-wrapper" class="main-wrapper">
<div class="sticky-section left-sticky-section" id="tool-section">
<div class="sticky-section-wrap">
<div class="vertical-centerer">
<ul id="tools-container" class="tools-wrapper"></ul>
<div class="palette-wrapper">
<div class="tool-icon tool-color-picker">
<input id="color-picker" class="color {hash:true}" type="text" value="" />
<input id="secondary-color-picker" class="secondary-color-picker color {hash:true}" type="text" value="" />
</div>
<div class="tool-icon tool-palette">
<div id="palette" class="palette">
<span class="tool-icon palette-color transparent-color" data-color="TRANSPARENT" title="Transparent"></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="application-action-section" class="sticky-section right-sticky-section">
<div class="sticky-section-wrap">
<div class="vertical-centerer">
<div id="settings" class="tool-icon gear-icon" title="Preferences" rel="tooltip" data-placement="left"></div>
<a class="tool-icon gallery-icon" title="Visit gallery" href="http://juliandescottes.github.io/piskel-website/" rel="tooltip" data-placement="left" target="_blank"></a>
<div class="tool-icon save-icon" title="Save to gallery" onclick="pskl.app.storeSheet()" rel="tooltip" data-placement="left" ></div>
<div class="tool-icon upload-cloud-icon" title="Upload as an animated GIF" onclick="pskl.app.uploadAsAnimatedGIF()" rel="tooltip" data-placement="left">
<span class="label">GIF</span>
</div>
<div class="tool-icon upload-cloud-icon" title="Upload as a spritesheet PNG" onclick="pskl.app.uploadAsSpritesheetPNG()" rel="tooltip" data-placement="left">
<span class="label">PNG</span>
</div>
</div>
<div class="drawer vertical-centerer">
<div class="drawer-content">
<div class="settings-section">
<div class="settings-title">
Canvas settings:
</div>
<div class="settings-item">
<label>Background:</label>
<div id="background-picker-wrapper" class="background-picker-wrapper">
<div class="background-picker light-picker-background" data-background-class="light-canvas-background"
rel="tooltip" data-placement="bottom" title="light / high contrast">
</div>
<div class="background-picker medium-picker-background" data-background-class="medium-canvas-background"
rel="tooltip" data-placement="bottom" title="medium / high contrast">
</div>
<div class="background-picker lowcont-medium-picker-background" data-background-class="lowcont-medium-canvas-background"
rel="tooltip" data-placement="bottom" title="medium / low contrast">
</div>
<div class="background-picker lowcont-dark-picker-background" data-background-class="lowcont-dark-canvas-background"
rel="tooltip" data-placement="bottom" title="dark / low contrast">
</div>
</div>
</div>
<div class="settings-item">
<label for="show-grid">Show grid:</label> <input id="show-grid" type="checkbox"/>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="column-wrapper" class="column-wrapper">
<div class='column left-column'>
<!-- List of frames: -->
<div id="preview-list-wrapper" class="preview-list-wrapper">
<div id="preview-list-scroller" class="preview-list-scroller">
<ul class="preview-list" id="preview-list"></ul>
</div>
<div class="top-overflow"></div>
<div class="bottom-overflow"></div>
</div>
</div>
<div class='column main-column'>
<!-- Drawing area: -->
<div id="drawing-canvas-container" class="drawing-canvas-container canvas-container">
<div class="canvas-background"></div>
</div>
</div>
<div class="column right-column">
<!-- Animation preview: -->
<div class='preview-container'>
<div id='preview-canvas-container' class="canvas-container">
<div class="canvas-background"></div>
</div>
<div>
<span id="display-fps" class="display-fps">12 FPS</span>
<input id="preview-fps" class="range-fps" type="range" min="1" max="24" value="12"/>
</div>
</div>
</div>
</div>
</div>
<!-- Core libraries: -->
<script src="js/lib/jquery-1.8.0.js"></script>
<script src="js/lib/jquery-ui-1.10.3.custom.js"></script>
<script src="js/lib/pubsub.js"></script>
<script src="js/lib/bootstrap/bootstrap.js"></script>
<!-- GIF Encoding libraries -->
<script src="js/lib/gif/GIFEncoder.js"></script>
<script src="js/lib/gif/b64.js"></script>
<script src="js/lib/gif/NeuQuant.js"></script>
<script src="js/lib/gif/LZWEncoder.js"></script>
<!-- Application wide configuration -->
<script src="js/Constants.js"></script>
<script src="js/Events.js"></script>
<!-- Libraries -->
<script src="js/utils/core.js"></script>
<script src="js/utils/PixelUtils.js"></script>
<script src="js/utils/CanvasUtils.js"></script>
<script src="js/utils/UserSettings.js"></script>
<script src="js/lib/jsColor_1_4_0/jscolor.js"></script>
<!-- Application libraries-->
<script src="js/rendering/DrawingLoop.js"></script>
<!-- Models -->
<script src="js/model/Frame.js"></script>
<script src="js/model/FrameSheet.js"></script>
<script src="js/selection/SelectionManager.js"></script>
<script src="js/selection/BaseSelection.js"></script>
<script src="js/selection/RectangularSelection.js"></script>
<script src="js/selection/ShapeSelection.js"></script>
<!-- Rendering -->
<script src="js/rendering/CanvasRenderer.js"></script>
<script src="js/rendering/FrameRenderer.js"></script>
<script src="js/rendering/SpritesheetRenderer.js"></script>
<!-- Controllers -->
<script src="js/controller/DrawingController.js"></script>
<script src="js/controller/PreviewFilmController.js"></script>
<script src="js/controller/AnimatedPreviewController.js"></script>
<script src="js/controller/ToolController.js"></script>
<script src="js/controller/PaletteController.js"></script>
<script src="js/controller/NotificationController.js"></script>
<script src="js/controller/SettingsController.js"></script>
<!-- Services -->
<script src="js/service/LocalStorageService.js"></script>
<script src="js/service/HistoryService.js"></script>
<script src="js/service/KeyboardEventService.js"></script>
<!-- Tools-->
<script src="js/drawingtools/BaseTool.js"></script>
<script src="js/drawingtools/SimplePen.js"></script>
<script src="js/drawingtools/VerticalMirrorPen.js"></script>
<script src="js/drawingtools/Eraser.js"></script>
<script src="js/drawingtools/Stroke.js"></script>
<script src="js/drawingtools/PaintBucket.js"></script>
<script src="js/drawingtools/Rectangle.js"></script>
<script src="js/drawingtools/Circle.js"></script>
<script src="js/drawingtools/Move.js"></script>
<script src="js/drawingtools/selectiontools/BaseSelect.js"></script>
<script src="js/drawingtools/selectiontools/RectangleSelect.js"></script>
<script src="js/drawingtools/selectiontools/ShapeSelect.js"></script>
<script src="js/drawingtools/ColorPicker.js"></script>
<!-- Application controller and initialization -->
<script src="js/piskel.js"></script>
</body>
</html>

View File

@ -1,36 +0,0 @@
// TODO(grosbouddha): put under pskl namespace.
var Constants = {
DEFAULT_SIZE : {
height : 32,
width : 32
},
MAX_HEIGHT : 128,
MAX_WIDTH : 128,
DEFAULT_PEN_COLOR : '#000000',
TRANSPARENT_COLOR : 'TRANSPARENT',
/*
* Fake semi-transparent color used to highlight transparent
* strokes and rectangles:
*/
SELECTION_TRANSPARENT_COLOR: 'rgba(255, 255, 255, 0.6)',
/*
* When a tool is hovering the drawing canvas, we highlight the eventual
* pixel target with this color:
*/
TOOL_TARGET_HIGHLIGHT_COLOR: 'rgba(255, 255, 255, 0.2)',
/*
* Default entry point for piskel web service:
*/
PISKEL_SERVICE_URL: 'http://3.piskel-app.appspot.com',
GRID_STROKE_WIDTH: 1,
GRID_STROKE_COLOR: "lightgray",
LEFT_BUTTON : "left_button_1",
RIGHT_BUTTON : "right_button_2"
};

View File

@ -1,64 +0,0 @@
// TODO(grosbouddha): put under pskl namespace.
Events = {
TOOL_SELECTED : "TOOL_SELECTED",
TOOL_RELEASED : "TOOL_RELEASED",
PRIMARY_COLOR_SELECTED: "PRIMARY_COLOR_SELECTED",
PRIMARY_COLOR_UPDATED: "PRIMARY_COLOR_UPDATED",
SECONDARY_COLOR_SELECTED: "SECONDARY_COLOR_SELECTED",
SECONDARY_COLOR_UPDATED: "SECONDARY_COLOR_UPDATED",
/**
* When this event is emitted, a request is sent to the localstorage
* Service to save the current framesheet. The storage service
* may not immediately store data (internal throttling of requests).
*/
LOCALSTORAGE_REQUEST: "LOCALSTORAGE_REQUEST",
CANVAS_RIGHT_CLICKED: "CANVAS_RIGHT_CLICKED",
/**
* Event to request a refresh of the display.
* A bit overkill but, it's just workaround in our current drawing system.
* TODO: Remove or rework when redraw system is refactored.
*/
REFRESH: "REFRESH",
/**
* Temporary event to bind the redraw of right preview film to the canvas.
* This redraw should be driven by model updates.
* TODO(vincz): Remove.
*/
REDRAW_PREVIEWFILM: "REDRAW_PREVIEWFILM",
/**
* Fired each time a user setting change.
* The payload will be:
* 1st argument: Name of the settings
* 2nd argument: New value
*/
USER_SETTINGS_CHANGED: "USER_SETTINGS_CHANGED",
/**
* The framesheet was reseted and is now probably drastically different.
* Number of frames, content of frames, color used for the palette may have changed.
*/
FRAMESHEET_RESET: "FRAMESHEET_RESET",
FRAME_SIZE_CHANGED : "FRAME_SIZE_CHANGED",
CURRENT_FRAME_SET: "CURRENT_FRAME_SET",
SELECTION_CREATED: "SELECTION_CREATED",
SELECTION_MOVE_REQUEST: "SELECTION_MOVE_REQUEST",
SELECTION_DISMISSED: "SELECTION_DISMISSED",
SHOW_NOTIFICATION: "SHOW_NOTIFICATION",
HIDE_NOTIFICATION: "HIDE_NOTIFICATION",
UNDO: "UNDO",
REDO: "REDO",
CUT: "CUT",
COPY: "COPY",
PASTE: "PASTE"
};

View File

@ -1,67 +0,0 @@
(function () {
var ns = $.namespace("pskl.controller");
ns.AnimatedPreviewController = function (framesheet, container, dpi) {
this.framesheet = framesheet;
this.container = container;
this.elapsedTime = 0;
this.currentIndex = 0;
this.fps = parseInt($("#preview-fps")[0].value, 10);
var renderingOptions = {
"dpi": this.calculateDPI_()
};
this.renderer = new pskl.rendering.FrameRenderer(this.container, renderingOptions);
$.subscribe(Events.FRAME_SIZE_CHANGED, this.updateDPI_.bind(this));
};
ns.AnimatedPreviewController.prototype.init = function () {
// the oninput event won't work on IE10 unfortunately, but at least will provide a
// consistent behavior across all other browsers that support the input type range
// see https://bugzilla.mozilla.org/show_bug.cgi?id=853670
$("#preview-fps")[0].addEventListener('change', this.onFPSSliderChange.bind(this));
};
ns.AnimatedPreviewController.prototype.onFPSSliderChange = function (evt) {
this.setFPS(parseInt($("#preview-fps")[0].value, 10));
};
ns.AnimatedPreviewController.prototype.setFPS = function (fps) {
this.fps = fps;
$("#preview-fps").val(this.fps);
$("#display-fps").html(this.fps + " FPS");
};
ns.AnimatedPreviewController.prototype.render = function (delta) {
this.elapsedTime += delta;
var index = Math.floor(this.elapsedTime / (1000/this.fps));
if (index != this.currentIndex) {
this.currentIndex = index;
if (!this.framesheet.hasFrameAtIndex(this.currentIndex)) {
this.currentIndex = 0;
this.elapsedTime = 0;
}
this.renderer.render(this.framesheet.getFrameByIndex(this.currentIndex));
}
};
/**
* Calculate the preview DPI depending on the framesheet size
*/
ns.AnimatedPreviewController.prototype.calculateDPI_ = function () {
var previewSize = 200,
framePixelHeight = this.framesheet.getCurrentFrame().getHeight(),
framePixelWidth = this.framesheet.getCurrentFrame().getWidth();
// TODO (julz) : should have a utility to get a Size from framesheet easily (what about empty framesheets though ?)
//return pskl.PixelUtils.calculateDPIForContainer($(".preview-container"), framePixelHeight, framePixelWidth);
return pskl.PixelUtils.calculateDPI(previewSize, previewSize, framePixelHeight, framePixelWidth);
};
ns.AnimatedPreviewController.prototype.updateDPI_ = function () {
this.dpi = this.calculateDPI_();
this.renderer.updateDPI(this.dpi);
};
})();

View File

@ -1,313 +0,0 @@
(function () {
var ns = $.namespace("pskl.controller");
ns.DrawingController = function (framesheet, container) {
/**
* @public
*/
this.framesheet = framesheet;
/**
* @public
*/
this.overlayFrame = pskl.model.Frame.createEmptyFromFrame(framesheet.getCurrentFrame());
/**
* @private
*/
this.container = container;
// TODO(vincz): Store user prefs in a localstorage string ?
var renderingOptions = {
"dpi": this.calculateDPI_(),
"supportGridRendering" : true
};
this.renderer = new pskl.rendering.FrameRenderer(this.container, renderingOptions, "drawing-canvas");
this.overlayRenderer = new pskl.rendering.FrameRenderer(this.container, renderingOptions, "canvas-overlay");
this.renderer.init(framesheet.getCurrentFrame());
this.overlayRenderer.init(this.overlayFrame);
// State of drawing controller:
this.isClicked = false;
this.isRightClicked = false;
this.previousMousemoveTime = 0;
this.currentToolBehavior = null;
this.primaryColor = Constants.DEFAULT_PEN_COLOR;
this.secondaryColor = Constants.TRANSPARENT_COLOR;
this.initMouseBehavior();
$.subscribe(Events.TOOL_SELECTED, $.proxy(function(evt, toolBehavior) {
console.log("Tool selected: ", toolBehavior);
this.currentToolBehavior = toolBehavior;
}, this));
/**
* TODO(grosbouddha): Primary/secondary color state are kept in this general controller.
* Find a better place to store that. Perhaps PaletteController?
*/
$.subscribe(Events.PRIMARY_COLOR_SELECTED, $.proxy(function(evt, color) {
console.log("Primary color selected: ", color);
this.primaryColor = color;
$.publish(Events.PRIMARY_COLOR_UPDATED, [color]);
}, this));
$.subscribe(Events.SECONDARY_COLOR_SELECTED, $.proxy(function(evt, color) {
console.log("Secondary color selected: ", color);
this.secondaryColor = color;
$.publish(Events.SECONDARY_COLOR_UPDATED, [color]);
}, this));
$(window).resize($.proxy(this.startDPIUpdateTimer_, this));
$.subscribe(Events.USER_SETTINGS_CHANGED, $.proxy(this.onUserSettingsChange_, this));
$.subscribe(Events.FRAME_SIZE_CHANGED, $.proxy(this.updateDPI_, this));
this.updateDPI_();
};
ns.DrawingController.prototype.initMouseBehavior = function() {
var body = $('body');
this.container.mousedown($.proxy(this.onMousedown_, this));
this.container.mousemove($.proxy(this.onMousemove_, this));
body.mouseup($.proxy(this.onMouseup_, this));
// Deactivate right click:
body.contextmenu(this.onCanvasContextMenu_);
};
ns.DrawingController.prototype.startDPIUpdateTimer_ = function () {
if (this.dpiUpdateTimer) {
window.clearInterval(this.dpiUpdateTimer);
}
this.dpiUpdateTimer = window.setTimeout($.proxy(this.updateDPI_, this), 200);
},
/**
* @private
*/
ns.DrawingController.prototype.onUserSettingsChange_ = function (evt, settingsName, settingsValue) {
if(settingsName == pskl.UserSettings.SHOW_GRID) {
this.updateDPI_();
}
},
/**
* @private
*/
ns.DrawingController.prototype.onMousedown_ = function (event) {
this.isClicked = true;
if(event.button == 2) { // right click
this.isRightClicked = true;
$.publish(Events.CANVAS_RIGHT_CLICKED);
}
var coords = this.getSpriteCoordinates(event);
this.currentToolBehavior.applyToolAt(
coords.col, coords.row,
this.getCurrentColor_(),
this.framesheet.getCurrentFrame(),
this.overlayFrame,
this.wrapEvtInfo_(event)
);
$.publish(Events.LOCALSTORAGE_REQUEST);
};
/**
* @private
*/
ns.DrawingController.prototype.onMousemove_ = function (event) {
var currentTime = new Date().getTime();
// Throttling of the mousemove event:
if ((currentTime - this.previousMousemoveTime) > 40 ) {
var coords = this.getSpriteCoordinates(event);
if (this.isClicked) {
this.currentToolBehavior.moveToolAt(
coords.col, coords.row,
this.getCurrentColor_(),
this.framesheet.getCurrentFrame(),
this.overlayFrame,
this.wrapEvtInfo_(event)
);
// TODO(vincz): Find a way to move that to the model instead of being at the interaction level.
// Eg when drawing, it may make sense to have it here. However for a non drawing tool,
// you don't need to draw anything when mousemoving and you request useless localStorage.
$.publish(Events.LOCALSTORAGE_REQUEST);
} else {
this.currentToolBehavior.moveUnactiveToolAt(
coords.col, coords.row,
this.getCurrentColor_(),
this.framesheet.getCurrentFrame(),
this.overlayFrame,
this.wrapEvtInfo_(event)
);
}
this.previousMousemoveTime = currentTime;
}
};
/**
* @private
*/
ns.DrawingController.prototype.onMouseup_ = function (event) {
if(this.isClicked || this.isRightClicked) {
// A mouse button was clicked on the drawing canvas before this mouseup event,
// the user was probably drawing on the canvas.
// Note: The mousemove movement (and the mouseup) may end up outside
// of the drawing canvas.
this.isClicked = false;
this.isRightClicked = false;
var coords = this.getSpriteCoordinates(event);
//console.log("mousemove: col: " + spriteCoordinate.col + " - row: " + spriteCoordinate.row);
this.currentToolBehavior.releaseToolAt(
coords.col, coords.row,
this.getCurrentColor_(),
this.framesheet.getCurrentFrame(),
this.overlayFrame,
this.wrapEvtInfo_(event)
);
$.publish(Events.TOOL_RELEASED);
}
},
/**
* @private
*/
ns.DrawingController.prototype.wrapEvtInfo_ = function (event) {
var evtInfo = {};
if (event.button === 0) {
evtInfo.button = Constants.LEFT_BUTTON;
} else if (event.button == 2) {
evtInfo.button = Constants.RIGHT_BUTTON;
}
return evtInfo;
},
/**
* @private
*/
ns.DrawingController.prototype.getRelativeCoordinates = function (clientX, clientY) {
var canvasPageOffset = this.container.offset();
return {
x : clientX - canvasPageOffset.left,
y : clientY - canvasPageOffset.top
};
};
/**
* @private
*/
ns.DrawingController.prototype.getSpriteCoordinates = function(event) {
var coords = this.getRelativeCoordinates(event.clientX, event.clientY);
return this.renderer.convertPixelCoordinatesIntoSpriteCoordinate(coords);
};
/**
* @private
*/
ns.DrawingController.prototype.getCurrentColor_ = function () {
if(this.isRightClicked) {
return this.secondaryColor;
} else {
return this.primaryColor;
}
};
/**
* @private
*/
ns.DrawingController.prototype.onCanvasContextMenu_ = function (event) {
if ($(event.target).closest('#drawing-canvas-container').length) {
// Deactivate right click on drawing canvas only.
event.preventDefault();
event.stopPropagation();
event.cancelBubble = true;
return false;
}
};
ns.DrawingController.prototype.render = function () {
this.renderFrame();
this.renderOverlay();
};
ns.DrawingController.prototype.renderFrame = function () {
var frame = this.framesheet.getCurrentFrame();
var serializedFrame = frame.serialize();
if (this.serializedFrame != serializedFrame) {
if (!frame.isSameSize(this.overlayFrame)) {
this.overlayFrame = pskl.model.Frame.createEmptyFromFrame(frame);
}
this.serializedFrame = serializedFrame;
this.renderer.render(frame);
}
};
ns.DrawingController.prototype.renderOverlay = function () {
var serializedOverlay = this.overlayFrame.serialize();
if (this.serializedOverlay != serializedOverlay) {
this.serializedOverlay = serializedOverlay;
this.overlayRenderer.render(this.overlayFrame);
}
};
ns.DrawingController.prototype.forceRendering_ = function () {
this.serializedFrame = this.serializedOverlay = null;
};
/**
* @private
*/
ns.DrawingController.prototype.calculateDPI_ = function() {
var availableViewportHeight = $('#main-wrapper').height(),
leftSectionWidth = $('.left-column').outerWidth(true),
rightSectionWidth = $('.right-column').outerWidth(true),
availableViewportWidth = $('#main-wrapper').width() - leftSectionWidth - rightSectionWidth,
framePixelHeight = this.framesheet.getCurrentFrame().getHeight(),
framePixelWidth = this.framesheet.getCurrentFrame().getWidth();
if (pskl.UserSettings.get(pskl.UserSettings.SHOW_GRID)) {
availableViewportWidth = availableViewportWidth - (framePixelWidth * Constants.GRID_STROKE_WIDTH);
availableViewportHeight = availableViewportHeight - (framePixelHeight * Constants.GRID_STROKE_WIDTH);
}
var dpi = pskl.PixelUtils.calculateDPI(
availableViewportHeight, availableViewportWidth, framePixelHeight, framePixelWidth);
return dpi;
};
/**
* @private
*/
ns.DrawingController.prototype.updateDPI_ = function() {
var dpi = this.calculateDPI_();
this.renderer.updateDPI(dpi);
this.overlayRenderer.updateDPI(dpi);
var currentFrameHeight = this.framesheet.getCurrentFrame().getHeight();
var canvasHeight = currentFrameHeight * dpi;
if (pskl.UserSettings.get(pskl.UserSettings.SHOW_GRID)) {
canvasHeight += Constants.GRID_STROKE_WIDTH * currentFrameHeight;
}
var verticalGapInPixel = Math.floor(($('#main-wrapper').height() - canvasHeight) / 2);
$('#column-wrapper').css({
'top': verticalGapInPixel + 'px',
'height': canvasHeight + 'px'
});
this.forceRendering_();
};
})();

View File

@ -1,116 +0,0 @@
(function () {
var ns = $.namespace("pskl.controller");
ns.PaletteController = function () {
this.paletteRoot = null;
this.paletteColors = [];
};
/**
* @private
*/
ns.PaletteController.prototype.onPickerChange_ = function(evt, isPrimary) {
var inputPicker = $(evt.target);
if(evt.data.isPrimary) {
$.publish(Events.PRIMARY_COLOR_SELECTED, [inputPicker.val()]);
}
else {
$.publish(Events.SECONDARY_COLOR_SELECTED, [inputPicker.val()]);
}
};
/**
* @private
*/
ns.PaletteController.prototype.addColorToPalette_ = function (color) {
if (this.paletteColors.indexOf(color) == -1 && color != Constants.TRANSPARENT_COLOR) {
this.paletteColors.push(color);
}
};
/**
* @private
*/
ns.PaletteController.prototype.addColorsToPalette_ = function (colors) {
for(var color in colors) {
this.addColorToPalette_(color);
}
};
/**
* @private
*/
ns.PaletteController.prototype.onPaletteColorClick_ = function (event) {
var selectedColor = $(event.target).data("color");
var isLeftClick = (event.which == 1);
var isRightClick = (event.which == 3);
if (isLeftClick) {
$.publish(Events.PRIMARY_COLOR_SELECTED, [selectedColor]);
} else if (isRightClick) {
$.publish(Events.SECONDARY_COLOR_SELECTED, [selectedColor]);
}
};
/**
* @private
*/
ns.PaletteController.prototype.updateColorPicker_ = function (color, colorPicker) {
if (color == Constants.TRANSPARENT_COLOR) {
// We can set the current palette color to transparent.
// You can then combine this transparent color with an advanced
// tool for customized deletions.
// Eg: bucket + transparent: Delete a colored area
// Stroke + transparent: hollow out the equivalent of a stroke
// The colorpicker can't be set to a transparent state.
// We set its background to white and insert the
// string "TRANSPARENT" to mimic this state:
colorPicker[0].color.fromString("#fff");
colorPicker.val(Constants.TRANSPARENT_COLOR);
} else {
colorPicker[0].color.fromString(color);
}
};
/**
* @public
*/
ns.PaletteController.prototype.init = function(framesheet) {
this.paletteRoot = $("#palette");
this.framesheet = framesheet;
// Initialize palette:
this.addColorsToPalette_(this.framesheet.getUsedColors());
$.subscribe(Events.FRAMESHEET_RESET, $.proxy(function(evt) {
this.addColorsToPalette_(this.framesheet.getUsedColors());
}, this));
this.paletteRoot.mouseup($.proxy(this.onPaletteColorClick_, this));
$.subscribe(Events.PRIMARY_COLOR_UPDATED, $.proxy(function(evt, color) {
this.updateColorPicker_(color, $('#color-picker'));
this.addColorToPalette_(color);
}, this));
$.subscribe(Events.SECONDARY_COLOR_UPDATED, $.proxy(function(evt, color) {
this.updateColorPicker_(color, $('#secondary-color-picker'));
this.addColorToPalette_(color);
}, this));
// Initialize colorpickers:
var colorPicker = $('#color-picker');
colorPicker.val(Constants.DEFAULT_PEN_COLOR);
colorPicker.change({isPrimary : true}, $.proxy(this.onPickerChange_, this));
var secondaryColorPicker = $('#secondary-color-picker');
secondaryColorPicker.val(Constants.TRANSPARENT_COLOR);
secondaryColorPicker.change({isPrimary : false}, $.proxy(this.onPickerChange_, this));
};
})();

View File

@ -1,217 +0,0 @@
(function () {
var ns = $.namespace("pskl.controller");
ns.PreviewFilmController = function (framesheet, container, dpi) {
this.framesheet = framesheet;
this.container = container;
this.dpi = this.calculateDPI_();
this.redrawFlag = true;
$.subscribe(Events.TOOL_RELEASED, this.flagForRedraw_.bind(this));
$.subscribe(Events.FRAMESHEET_RESET, this.flagForRedraw_.bind(this));
$.subscribe(Events.FRAMESHEET_RESET, this.refreshDPI_.bind(this));
$('#preview-list-scroller').scroll(this.updateScrollerOverflows.bind(this));
this.updateScrollerOverflows();
};
ns.PreviewFilmController.prototype.init = function() {};
ns.PreviewFilmController.prototype.addFrame = function () {
this.framesheet.addEmptyFrame();
this.framesheet.setCurrentFrameIndex(this.framesheet.getFrameCount() - 1);
this.updateScrollerOverflows();
};
ns.PreviewFilmController.prototype.flagForRedraw_ = function () {
this.redrawFlag = true;
};
ns.PreviewFilmController.prototype.refreshDPI_ = function () {
this.dpi = this.calculateDPI_();
};
ns.PreviewFilmController.prototype.render = function () {
if (this.redrawFlag) {
// TODO(vincz): Full redraw on any drawing modification, optimize.
this.createPreviews_();
this.redrawFlag = false;
}
};
ns.PreviewFilmController.prototype.updateScrollerOverflows = function () {
var scroller = $('#preview-list-scroller');
var scrollerHeight = scroller.height();
var scrollTop = scroller.scrollTop();
var scrollerContentHeight = $('#preview-list').height();
var treshold = $('.top-overflow').height();
var overflowTop = false,
overflowBottom = false;
if (scrollerHeight < scrollerContentHeight) {
if (scrollTop > treshold) {
overflowTop = true;
}
var scrollBottom = (scrollerContentHeight - scrollTop) - scrollerHeight;
if (scrollBottom > treshold) {
overflowBottom = true;
}
}
var wrapper = $('#preview-list-wrapper');
wrapper.toggleClass('top-overflow-visible', overflowTop);
wrapper.toggleClass('bottom-overflow-visible', overflowBottom);
};
ns.PreviewFilmController.prototype.createPreviews_ = function () {
this.container.html("");
// Manually remove tooltips since mouseout events were shortcut by the DOM refresh:
$(".tooltip").remove();
var frameCount = this.framesheet.getFrameCount();
for (var i = 0, l = frameCount; i < l ; i++) {
this.container.append(this.createPreviewTile_(i));
}
// Append 'new empty frame' button
var newFrameButton = document.createElement("div");
newFrameButton.id = "add-frame-action";
newFrameButton.className = "add-frame-action";
newFrameButton.innerHTML = "<p class='label'>Add new frame</p>";
this.container.append(newFrameButton);
$(newFrameButton).click(this.addFrame.bind(this));
var needDragndropBehavior = (frameCount > 1);
if(needDragndropBehavior) {
this.initDragndropBehavior_();
}
this.updateScrollerOverflows();
};
/**
* @private
*/
ns.PreviewFilmController.prototype.initDragndropBehavior_ = function () {
$("#preview-list").sortable({
placeholder: "preview-tile-drop-proxy",
update: $.proxy(this.onUpdate_, this),
items: ".preview-tile"
});
$("#preview-list").disableSelection();
};
/**
* @private
*/
ns.PreviewFilmController.prototype.onUpdate_ = function( event, ui ) {
var originFrameId = parseInt(ui.item.data("tile-number"), 10);
var targetInsertionId = $('.preview-tile').index(ui.item);
this.framesheet.moveFrame(originFrameId, targetInsertionId);
this.framesheet.setCurrentFrameIndex(targetInsertionId);
// TODO(grosbouddha): move localstorage request to the model layer?
$.publish(Events.LOCALSTORAGE_REQUEST);
};
/**
* @private
* TODO(vincz): clean this giant rendering function & remove listeners.
*/
ns.PreviewFilmController.prototype.createPreviewTile_ = function(tileNumber) {
var currentFrame = this.framesheet.getFrameByIndex(tileNumber);
var previewTileRoot = document.createElement("li");
var classname = "preview-tile";
previewTileRoot.setAttribute("data-tile-number", tileNumber);
if (this.framesheet.getCurrentFrame() == currentFrame) {
classname += " selected";
}
previewTileRoot.className = classname;
var canvasContainer = document.createElement("div");
canvasContainer.className = "canvas-container";
var canvasBackground = document.createElement("div");
canvasBackground.className = "canvas-background";
canvasContainer.appendChild(canvasBackground);
previewTileRoot.addEventListener('click', this.onPreviewClick_.bind(this, tileNumber));
var cloneFrameButton = document.createElement("button");
cloneFrameButton.setAttribute('rel', 'tooltip');
cloneFrameButton.setAttribute('data-placement', 'right');
cloneFrameButton.setAttribute('title', 'Duplicate this frame');
cloneFrameButton.className = "tile-overlay duplicate-frame-action";
previewTileRoot.appendChild(cloneFrameButton);
cloneFrameButton.addEventListener('click', this.onAddButtonClick_.bind(this, tileNumber));
// TODO(vincz): Eventually optimize this part by not recreating a FrameRenderer. Note that the real optim
// is to make this update function (#createPreviewTile) less aggressive.
var renderingOptions = {"dpi": this.dpi };
var currentFrameRenderer = new pskl.rendering.FrameRenderer($(canvasContainer), renderingOptions, "tile-view");
currentFrameRenderer.init(currentFrame);
previewTileRoot.appendChild(canvasContainer);
if(tileNumber > 0 || this.framesheet.getFrameCount() > 1) {
// Add 'remove frame' button.
var deleteButton = document.createElement("button");
deleteButton.setAttribute('rel', 'tooltip');
deleteButton.setAttribute('data-placement', 'right');
deleteButton.setAttribute('title', 'Delete this frame');
deleteButton.className = "tile-overlay delete-frame-action";
deleteButton.addEventListener('click', this.onDeleteButtonClick_.bind(this, tileNumber));
previewTileRoot.appendChild(deleteButton);
// Add 'dragndrop handle'.
var dndHandle = document.createElement("div");
dndHandle.className = "tile-overlay dnd-action";
previewTileRoot.appendChild(dndHandle);
}
var tileCount = document.createElement("div");
tileCount.className = "tile-overlay tile-count";
tileCount.innerHTML = tileNumber;
previewTileRoot.appendChild(tileCount);
return previewTileRoot;
};
ns.PreviewFilmController.prototype.onPreviewClick_ = function (index, evt) {
// has not class tile-action:
if(!evt.target.classList.contains('tile-overlay')) {
this.framesheet.setCurrentFrameIndex(index);
}
};
ns.PreviewFilmController.prototype.onDeleteButtonClick_ = function (index, evt) {
this.framesheet.removeFrameByIndex(index);
$.publish(Events.LOCALSTORAGE_REQUEST); // Should come from model
this.updateScrollerOverflows();
};
ns.PreviewFilmController.prototype.onAddButtonClick_ = function (index, evt) {
this.framesheet.duplicateFrameByIndex(index);
$.publish(Events.LOCALSTORAGE_REQUEST); // Should come from model
this.framesheet.setCurrentFrameIndex(index + 1);
this.updateScrollerOverflows();
};
/**
* Calculate the preview DPI depending on the framesheet size
*/
ns.PreviewFilmController.prototype.calculateDPI_ = function () {
var previewSize = 120,
framePixelHeight = this.framesheet.getCurrentFrame().getHeight(),
framePixelWidth = this.framesheet.getCurrentFrame().getWidth();
// TODO (julz) : should have a utility to get a Size from framesheet easily (what about empty framesheets though ?)
return pskl.PixelUtils.calculateDPI(previewSize, previewSize, framePixelHeight, framePixelWidth);
};
})();

View File

@ -1,45 +0,0 @@
(function () {
var ns = $.namespace("pskl.controller");
ns.SettingsController = function () {};
/**
* @public
*/
ns.SettingsController.prototype.init = function() {
// Highlight selected background picker:
var backgroundClass = pskl.UserSettings.get(pskl.UserSettings.CANVAS_BACKGROUND);
$('#background-picker-wrapper')
.find('.background-picker[data-background-class=' + backgroundClass + ']')
.addClass('selected');
// Initial state for grid display:
var show_grid = pskl.UserSettings.get(pskl.UserSettings.SHOW_GRID);
$('#show-grid').prop('checked', show_grid);
// Expand drawer when clicking 'Settings' tab.
$('#settings').click(function(evt) {
$('.right-sticky-section').toggleClass('expanded');
$('#settings').toggleClass('has-expanded-drawer');
});
// Handle grid display changes:
$('#show-grid').change($.proxy(function(evt) {
var checked = $('#show-grid').prop('checked');
pskl.UserSettings.set(pskl.UserSettings.SHOW_GRID, checked);
}, this));
// Handle canvas background changes:
$('#background-picker-wrapper').click(function(evt) {
var target = $(evt.target).closest('.background-picker');
if (target.length) {
var backgroundClass = target.data('background-class');
pskl.UserSettings.set(pskl.UserSettings.CANVAS_BACKGROUND, backgroundClass);
$('.background-picker').removeClass('selected');
target.addClass('selected');
}
});
};
})();

View File

@ -1,99 +0,0 @@
(function () {
var ns = $.namespace("pskl.controller");
ns.ToolController = function () {
this.toolInstances = {
"simplePen" : new pskl.drawingtools.SimplePen(),
"verticalMirrorPen" : new pskl.drawingtools.VerticalMirrorPen(),
"eraser" : new pskl.drawingtools.Eraser(),
"paintBucket" : new pskl.drawingtools.PaintBucket(),
"stroke" : new pskl.drawingtools.Stroke(),
"rectangle" : new pskl.drawingtools.Rectangle(),
"circle" : new pskl.drawingtools.Circle(),
"move" : new pskl.drawingtools.Move(),
"rectangleSelect" : new pskl.drawingtools.RectangleSelect(),
"shapeSelect" : new pskl.drawingtools.ShapeSelect(),
"colorPicker" : new pskl.drawingtools.ColorPicker()
};
this.currentSelectedTool = this.toolInstances.simplePen;
this.previousSelectedTool = this.toolInstances.simplePen;
};
/**
* @private
*/
ns.ToolController.prototype.activateToolOnStage_ = function(tool) {
var stage = $("body");
var previousSelectedToolClass = stage.data("selected-tool-class");
if(previousSelectedToolClass) {
stage.removeClass(previousSelectedToolClass);
}
stage.addClass(tool.toolId);
stage.data("selected-tool-class", tool.toolId);
};
/**
* @private
*/
ns.ToolController.prototype.selectTool_ = function(tool) {
console.log("Selecting Tool:" , this.currentSelectedTool);
this.currentSelectedTool = tool;
this.activateToolOnStage_(this.currentSelectedTool);
$.publish(Events.TOOL_SELECTED, [tool]);
};
/**
* @private
*/
ns.ToolController.prototype.onToolIconClicked_ = function(evt) {
var target = $(evt.target);
var clickedTool = target.closest(".tool-icon");
if(clickedTool.length) {
for(var tool in this.toolInstances) {
if (this.toolInstances[tool].toolId == clickedTool.data().toolId) {
this.selectTool_(this.toolInstances[tool]);
// Show tool as selected:
$('#tool-section .tool-icon.selected').removeClass('selected');
clickedTool.addClass('selected');
}
}
}
};
/**
* @private
*/
ns.ToolController.prototype.createToolMarkup_ = function() {
var currentTool, toolMarkup = '', extraClass;
// TODO(vincz): Tools rendering order is not enforced by the data stucture (this.toolInstances), fix that.
for (var toolKey in this.toolInstances) {
currentTool = this.toolInstances[toolKey];
extraClass = currentTool.toolId;
if (this.currentSelectedTool == currentTool) {
extraClass = extraClass + " selected";
}
toolMarkup += '<li rel="tooltip" data-placement="right" class="tool-icon ' + extraClass + '" data-tool-id="' + currentTool.toolId +
'" title="' + currentTool.helpText + '"></li>';
}
$('#tools-container').html(toolMarkup);
};
/**
* @public
*/
ns.ToolController.prototype.init = function() {
this.createToolMarkup_();
// Initialize tool:
// Set SimplePen as default selected tool:
this.selectTool_(this.toolInstances.simplePen);
// Activate listener on tool panel:
$("#tool-section").click($.proxy(this.onToolIconClicked_, this));
};
})();

View File

@ -1,72 +0,0 @@
/*
* @provide pskl.drawingtools.BaseTool
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.BaseTool = function() {};
ns.BaseTool.prototype.applyToolAt = function(col, row, color, frame, overlay) {};
ns.BaseTool.prototype.moveToolAt = function(col, row, color, frame, overlay) {};
ns.BaseTool.prototype.moveUnactiveToolAt = function(col, row, color, frame, overlay) {
if (overlay.containsPixel(col, row)) {
if (!isNaN(this.highlightedPixelCol) &&
!isNaN(this.highlightedPixelRow) &&
(this.highlightedPixelRow != row ||
this.highlightedPixelCol != col)) {
// Clean the previously highlighted pixel:
overlay.clear();
}
// Show the current pixel targeted by the tool:
overlay.setPixel(col, row, Constants.TOOL_TARGET_HIGHLIGHT_COLOR);
this.highlightedPixelCol = col;
this.highlightedPixelRow = row;
}
};
ns.BaseTool.prototype.releaseToolAt = function(col, row, color, frame, overlay) {};
/**
* Bresenham line algorihtm: Get an array of pixels from
* start and end coordinates.
*
* http://en.wikipedia.org/wiki/Bresenham's_line_algorithm
* http://stackoverflow.com/questions/4672279/bresenham-algorithm-in-javascript
*
* @private
*/
ns.BaseTool.prototype.getLinePixels_ = function(x0, x1, y0, y1) {
var pixels = [];
var dx = Math.abs(x1-x0);
var dy = Math.abs(y1-y0);
var sx = (x0 < x1) ? 1 : -1;
var sy = (y0 < y1) ? 1 : -1;
var err = dx-dy;
while(true){
// Do what you need to for this
pixels.push({"col": x0, "row": y0});
if ((x0==x1) && (y0==y1)) break;
var e2 = 2*err;
if (e2>-dy){
err -= dy;
x0 += sx;
}
if (e2 < dx) {
err += dx;
y0 += sy;
}
}
return pixels;
};
})();

View File

@ -1,85 +0,0 @@
/*
* @provide pskl.drawingtools.Circle
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.Circle = function() {
this.toolId = "tool-circle";
this.helpText = "Circle tool";
// Circle's first point coordinates (set in applyToolAt)
this.startCol = null;
this.startRow = null;
};
pskl.utils.inherit(ns.Circle, ns.BaseTool);
/**
* @override
*/
ns.Circle.prototype.applyToolAt = function(col, row, color, frame, overlay) {
this.startCol = col;
this.startRow = row;
// Drawing the first point of the rectangle in the fake overlay canvas:
overlay.setPixel(col, row, color);
};
ns.Circle.prototype.moveToolAt = function(col, row, color, frame, overlay) {
overlay.clear();
if(color == Constants.TRANSPARENT_COLOR) {
color = Constants.SELECTION_TRANSPARENT_COLOR;
}
// draw in overlay
this.drawCircle_(col, row, color, overlay);
};
/**
* @override
*/
ns.Circle.prototype.releaseToolAt = function(col, row, color, frame, overlay) {
overlay.clear();
if(frame.containsPixel(col, row)) { // cancel if outside of canvas
// draw in frame to finalize
this.drawCircle_(col, row, color, frame);
}
};
ns.Circle.prototype.drawCircle_ = function (col, row, color, targetFrame) {
var circlePoints = this.getCirclePixels_(this.startCol, this.startRow, col, row);
for(var i = 0; i< circlePoints.length; i++) {
// Change model:
targetFrame.setPixel(circlePoints[i].col, circlePoints[i].row, color);
}
};
ns.Circle.prototype.getCirclePixels_ = function (x0, y0, x1, y1) {
var coords = pskl.PixelUtils.getOrderedRectangleCoordinates(x0, y0, x1, y1);
var xC = (coords.x0 + coords.x1)/2;
var yC = (coords.y0 + coords.y1)/2;
var rX = coords.x1 - xC;
var rY = coords.y1 - yC;
var pixels = [];
var x, y, angle;
for (x = coords.x0 ; x < coords.x1 ; x++) {
angle = Math.acos((x - xC)/rX);
y = Math.round(rY * Math.sin(angle) + yC);
pixels.push({"col": x, "row": y});
pixels.push({"col": 2*xC - x, "row": 2*yC - y});
}
for (y = coords.y0 ; y < coords.y1 ; y++) {
angle = Math.asin((y - yC)/rY);
x = Math.round(rX * Math.cos(angle) + xC);
pixels.push({"col": x, "row": y});
pixels.push({"col": 2*xC - x, "row": 2*yC - y});
}
return pixels;
};
})();

View File

@ -1,29 +0,0 @@
/*
* @provide pskl.drawingtools.ColorPicker
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.ColorPicker = function() {
this.toolId = "tool-colorpicker";
this.helpText = "Color picker";
};
pskl.utils.inherit(ns.ColorPicker, ns.BaseTool);
/**
* @override
*/
ns.ColorPicker.prototype.applyToolAt = function(col, row, color, frame, overlay, context) {
if (frame.containsPixel(col, row)) {
var sampledColor = frame.getPixel(col, row);
if (context.button == Constants.LEFT_BUTTON) {
$.publish(Events.PRIMARY_COLOR_SELECTED, [sampledColor]);
} else if (context.button == Constants.RIGHT_BUTTON) {
$.publish(Events.SECONDARY_COLOR_SELECTED, [sampledColor]);
}
}
};
})();

View File

@ -1,23 +0,0 @@
/*
* @provide pskl.drawingtools.Eraser
*
* @require Constants
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.Eraser = function() {
this.toolId = "tool-eraser";
this.helpText = "Eraser tool";
};
pskl.utils.inherit(ns.Eraser, ns.SimplePen);
/**
* @override
*/
ns.Eraser.prototype.applyToolAt = function(col, row, color, frame, overlay) {
this.superclass.applyToolAt.call(this, col, row, Constants.TRANSPARENT_COLOR, frame, overlay);
};
})();

View File

@ -1,54 +0,0 @@
/*
* @provide pskl.drawingtools.Move
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.Move = function() {
this.toolId = "tool-move";
this.helpText = "Move tool";
// Stroke's first point coordinates (set in applyToolAt)
this.startCol = null;
this.startRow = null;
};
pskl.utils.inherit(ns.Move, ns.BaseTool);
/**
* @override
*/
ns.Move.prototype.applyToolAt = function(col, row, color, frame, overlay) {
this.startCol = col;
this.startRow = row;
this.frameClone = frame.clone();
};
ns.Move.prototype.moveToolAt = function(col, row, color, frame, overlay) {
var colDiff = col - this.startCol, rowDiff = row - this.startRow;
this.shiftFrame(colDiff, rowDiff, frame, this.frameClone);
};
ns.Move.prototype.shiftFrame = function (colDiff, rowDiff, frame, reference) {
var color;
for (var col = 0 ; col < frame.getWidth() ; col++) {
for (var row = 0 ; row < frame.getHeight() ; row++) {
if (reference.containsPixel(col - colDiff, row - rowDiff)) {
color = reference.getPixel(col - colDiff, row - rowDiff);
} else {
color = Constants.TRANSPARENT_COLOR;
}
frame.setPixel(col, row, color);
}
}
};
/**
* @override
*/
ns.Move.prototype.releaseToolAt = function(col, row, color, frame, overlay) {
this.moveToolAt(col, row, color, frame, overlay);
};
})();

View File

@ -1,36 +0,0 @@
/*
* @provide pskl.drawingtools.PaintBucket
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.PaintBucket = function() {
this.toolId = "tool-paint-bucket";
this.helpText = "Paint bucket tool";
};
pskl.utils.inherit(ns.PaintBucket, ns.BaseTool);
/**
* @override
*/
ns.PaintBucket.prototype.applyToolAt = function(col, row, color, frame, overlay) {
pskl.PixelUtils.paintSimilarConnectedPixelsFromFrame(frame, col, row, color);
};
})();

View File

@ -1,59 +0,0 @@
/*
* @provide pskl.drawingtools.Rectangle
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.Rectangle = function() {
this.toolId = "tool-rectangle";
this.helpText = "Rectangle tool";
// Rectangle's first point coordinates (set in applyToolAt)
this.startCol = null;
this.startRow = null;
};
pskl.utils.inherit(ns.Rectangle, ns.BaseTool);
/**
* @override
*/
ns.Rectangle.prototype.applyToolAt = function(col, row, color, frame, overlay) {
this.startCol = col;
this.startRow = row;
// Drawing the first point of the rectangle in the fake overlay canvas:
overlay.setPixel(col, row, color);
};
ns.Rectangle.prototype.moveToolAt = function(col, row, color, frame, overlay) {
overlay.clear();
if(color == Constants.TRANSPARENT_COLOR) {
color = Constants.SELECTION_TRANSPARENT_COLOR;
}
// draw in overlay
this.drawRectangle_(col, row, color, overlay);
};
/**
* @override
*/
ns.Rectangle.prototype.releaseToolAt = function(col, row, color, frame, overlay) {
overlay.clear();
if(frame.containsPixel(col, row)) { // cancel if outside of canvas
// draw in frame to finalize
this.drawRectangle_(col, row, color, frame);
}
};
ns.Rectangle.prototype.drawRectangle_ = function (col, row, color, targetFrame) {
var strokePoints = pskl.PixelUtils.getBoundRectanglePixels(this.startCol, this.startRow, col, row);
for(var i = 0; i< strokePoints.length; i++) {
// Change model:
targetFrame.setPixel(strokePoints[i].col, strokePoints[i].row, color);
}
};
})();

View File

@ -1,49 +0,0 @@
/*
* @provide pskl.drawingtools.SimplePen
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.SimplePen = function() {
this.toolId = "tool-pen";
this.helpText = "Pen tool";
this.previousCol = null;
this.previousRow = null;
};
pskl.utils.inherit(ns.SimplePen, ns.BaseTool);
/**
* @override
*/
ns.SimplePen.prototype.applyToolAt = function(col, row, color, frame, overlay) {
if (frame.containsPixel(col, row)) {
frame.setPixel(col, row, color);
}
this.previousCol = col;
this.previousRow = row;
};
ns.SimplePen.prototype.moveToolAt = function(col, row, color, frame, overlay) {
if((Math.abs(col - this.previousCol) > 1) || (Math.abs(row - this.previousRow) > 1)) {
// The pen movement is too fast for the mousemove frequency, there is a gap between the
// current point and the previously drawn one.
// We fill the gap by calculating missing dots (simple linear interpolation) and draw them.
var interpolatedPixels = this.getLinePixels_(col, this.previousCol, row, this.previousRow);
for(var i=0, l=interpolatedPixels.length; i<l; i++) {
var coords = interpolatedPixels[i];
this.applyToolAt(coords.col, coords.row, color, frame, overlay);
}
}
else {
this.applyToolAt(col, row, color, frame, overlay);
}
this.previousCol = col;
this.previousRow = row;
};
})();

View File

@ -1,80 +0,0 @@
/*
* @provide pskl.drawingtools.Stroke
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.Stroke = function() {
this.toolId = "tool-stroke";
this.helpText = "Stroke tool";
// Stroke's first point coordinates (set in applyToolAt)
this.startCol = null;
this.startRow = null;
};
pskl.utils.inherit(ns.Stroke, ns.BaseTool);
/**
* @override
*/
ns.Stroke.prototype.applyToolAt = function(col, row, color, frame, overlay) {
this.startCol = col;
this.startRow = row;
// When drawing a stroke we don't change the model instantly, since the
// user can move his cursor to change the stroke direction and length
// dynamically. Instead we draw the (preview) stroke in a fake canvas that
// overlay the drawing canvas.
// We wait for the releaseToolAt callback to impact both the
// frame model and canvas rendering.
// The fake canvas where we will draw the preview of the stroke:
// Drawing the first point of the stroke in the fake overlay canvas:
overlay.setPixel(col, row, color);
};
ns.Stroke.prototype.moveToolAt = function(col, row, color, frame, overlay) {
overlay.clear();
// When the user moussemove (before releasing), we dynamically compute the
// pixel to draw the line and draw this line in the overlay canvas:
var strokePoints = this.getLinePixels_(this.startCol, col, this.startRow, row);
// Drawing current stroke:
for(var i = 0; i< strokePoints.length; i++) {
if(color == Constants.TRANSPARENT_COLOR) {
// When mousemoving the stroke tool, we draw in the canvas overlay above the drawing canvas.
// If the stroke color is transparent, we won't be
// able to see it during the movement.
// We set it to a semi-opaque white during the tool mousemove allowing to see colors below the stroke.
// When the stroke tool will be released, It will draw a transparent stroke,
// eg deleting the equivalent of a stroke.
color = Constants.SELECTION_TRANSPARENT_COLOR;
}
overlay.setPixel(strokePoints[i].col, strokePoints[i].row, color);
}
};
/**
* @override
*/
ns.Stroke.prototype.releaseToolAt = function(col, row, color, frame, overlay) {
// If the stroke tool is released outside of the canvas, we cancel the stroke:
// TODO: Mutualize this check in common method
if(frame.containsPixel(col, row)) {
// The user released the tool to draw a line. We will compute the pixel coordinate, impact
// the model and draw them in the drawing canvas (not the fake overlay anymore)
var strokePoints = this.getLinePixels_(this.startCol, col, this.startRow, row);
for(var i = 0; i< strokePoints.length; i++) {
// Change model:
frame.setPixel(strokePoints[i].col, strokePoints[i].row, color);
}
}
// For now, we are done with the stroke tool and don't need an overlay anymore:
overlay.clear();
};
})();

View File

@ -1,46 +0,0 @@
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.VerticalMirrorPen = function() {
this.toolId = "tool-vertical-mirror-pen";
this.helpText = "vertical mirror pen tool";
this.swap = null;
this.mirroredPreviousCol = null;
this.mirroredPreviousRow = null;
};
pskl.utils.inherit(ns.VerticalMirrorPen, ns.SimplePen);
ns.VerticalMirrorPen.prototype.setMirrorContext = function() {
this.swap = this.previousCol;
this.previousCol = this.mirroredPreviousCol;
};
ns.VerticalMirrorPen.prototype.unsetMirrorContext = function() {
this.mirroredPreviousCol = this.previousCol;
this.previousCol = this.swap;
};
/**
* @override
*/
ns.VerticalMirrorPen.prototype.applyToolAt = function(col, row, color, frame, overlay) {
this.superclass.applyToolAt.call(this, col, row, color, frame, overlay);
var mirroredCol = this.getSymmetricCol_(col, frame);
this.mirroredPreviousCol = mirroredCol;
this.setMirrorContext();
this.superclass.applyToolAt.call(this, mirroredCol, row, color, frame, overlay);
this.unsetMirrorContext();
};
/**
* @private
*/
ns.VerticalMirrorPen.prototype.getSymmetricCol_ = function(col, frame) {
return frame.getWidth() - col - 1;
};
})();

View File

@ -1,150 +0,0 @@
/*
* @provide pskl.drawingtools.BaseSelect
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.BaseSelect = function() {
this.secondaryToolId = "tool-move";
this.BodyRoot = $('body');
// Select's first point coordinates (set in applyToolAt)
this.startCol = null;
this.startRow = null;
};
pskl.utils.inherit(ns.BaseSelect, ns.BaseTool);
/**
* @override
*/
ns.BaseSelect.prototype.applyToolAt = function(col, row, color, frame, overlay) {
this.startCol = col;
this.startRow = row;
this.lastCol = col;
this.lastRow = row;
// The select tool can be in two different state.
// If the inital click of the tool is not on a selection, we go in "select"
// mode to create a selection.
// If the initial click is on a previous selection, we go in "moveSelection"
// mode to allow to move the selection by drag'n dropping it.
if(overlay.getPixel(col, row) != Constants.SELECTION_TRANSPARENT_COLOR) {
this.mode = "select";
this.onSelectStart_(col, row, color, frame, overlay);
}
else {
this.mode = "moveSelection";
this.onSelectionDragStart_(col, row, color, frame, overlay);
}
};
/**
* @override
*/
ns.BaseSelect.prototype.moveToolAt = function(col, row, color, frame, overlay) {
if(this.mode == "select") {
this.onSelect_(col, row, color, frame, overlay);
}
else if(this.mode == "moveSelection") {
this.onSelectionDrag_(col, row, color, frame, overlay);
}
};
/**
* @override
*/
ns.BaseSelect.prototype.releaseToolAt = function(col, row, color, frame, overlay) {
if(this.mode == "select") {
this.onSelectEnd_(col, row, color, frame, overlay);
} else if(this.mode == "moveSelection") {
this.onSelectionDragEnd_(col, row, color, frame, overlay);
}
};
/**
* If we mouseover the selection draw inside the overlay frame, show the 'move' cursor
* instead of the 'select' one. It indicates that we can move the selection by dragndroping it.
* @override
*/
ns.BaseSelect.prototype.moveUnactiveToolAt = function(col, row, color, frame, overlay) {
if(overlay.getPixel(col, row) != Constants.SELECTION_TRANSPARENT_COLOR) {
// We're hovering the selection, show the move tool:
this.BodyRoot.addClass(this.toolId);
this.BodyRoot.removeClass(this.secondaryToolId);
} else {
// We're not hovering the selection, show create selection tool:
this.BodyRoot.addClass(this.secondaryToolId);
this.BodyRoot.removeClass(this.toolId);
}
};
/**
* Move the overlay frame filled with semi-transparent pixels that represent the selection.
* @private
*/
ns.BaseSelect.prototype.shiftOverlayFrame_ = function (colDiff, rowDiff, overlayFrame, reference) {
var color;
for (var col = 0 ; col < overlayFrame.getWidth() ; col++) {
for (var row = 0 ; row < overlayFrame.getHeight() ; row++) {
if (reference.containsPixel(col - colDiff, row - rowDiff)) {
color = reference.getPixel(col - colDiff, row - rowDiff);
} else {
color = Constants.TRANSPARENT_COLOR;
}
overlayFrame.setPixel(col, row, color);
}
}
};
// The list of callbacks to implement by specialized tools to implement the selection creation behavior.
/** @protected */
ns.BaseSelect.prototype.onSelectStart_ = function (col, row, color, frame, overlay) {};
/** @protected */
ns.BaseSelect.prototype.onSelect_ = function (col, row, color, frame, overlay) {};
/** @protected */
ns.BaseSelect.prototype.onSelectEnd_ = function (col, row, color, frame, overlay) {};
// The list of callbacks that define the drag'n drop behavior of the selection.
/** @private */
ns.BaseSelect.prototype.onSelectionDragStart_ = function (col, row, color, frame, overlay) {
// Since we will move the overlayFrame in which the current selection is rendered,
// we clone it to have a reference for the later shifting process.
this.overlayFrameReference = overlay.clone();
};
/** @private */
ns.BaseSelect.prototype.onSelectionDrag_ = function (col, row, color, frame, overlay) {
var deltaCol = col - this.lastCol;
var deltaRow = row - this.lastRow;
var colDiff = col - this.startCol, rowDiff = row - this.startRow;
// Shifting selection on overlay frame:
this.shiftOverlayFrame_(colDiff, rowDiff, overlay, this.overlayFrameReference);
// Update selection model:
$.publish(Events.SELECTION_MOVE_REQUEST, [deltaCol, deltaRow]);
this.lastCol = col;
this.lastRow = row;
};
/** @private */
ns.BaseSelect.prototype.onSelectionDragEnd_ = function (col, row, color, frame, overlay) {
this.onSelectionDrag_(col, row, color, frame, overlay);
};
})();

View File

@ -1,51 +0,0 @@
/*
* @provide pskl.drawingtools.RectangleSelect
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.RectangleSelect = function() {
this.toolId = "tool-rectangle-select";
this.helpText = "Rectangle selection tool";
ns.BaseSelect.call(this);
};
pskl.utils.inherit(ns.RectangleSelect, ns.BaseSelect);
/**
* @override
*/
ns.RectangleSelect.prototype.onSelectStart_ = function (col, row, color, frame, overlay) {
// Drawing the first point of the rectangle in the fake overlay canvas:
overlay.setPixel(col, row, color);
};
/**
* When creating the rectangle selection, we clear the current overlayFrame and
* redraw the current rectangle based on the orgin coordinate and
* the current mouse coordiinate in sprite.
* @override
*/
ns.RectangleSelect.prototype.onSelect_ = function (col, row, color, frame, overlay) {
overlay.clear();
if(this.startCol == col &&this.startRow == row) {
$.publish(Events.SELECTION_DISMISSED);
} else {
var selection = new pskl.selection.RectangularSelection(
this.startCol, this.startRow, col, row);
$.publish(Events.SELECTION_CREATED, [selection]);
}
};
/**
* @override
*/
ns.RectangleSelect.prototype.onSelectEnd_ = function (col, row, color, frame, overlay) {
this.onSelect_(col, row, color, frame, overlay);
};
})();

View File

@ -1,34 +0,0 @@
/*
* @provide pskl.drawingtools.ShapeSelect
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.ShapeSelect = function() {
this.toolId = "tool-shape-select";
this.helpText = "Shape selection tool";
ns.BaseSelect.call(this);
};
pskl.utils.inherit(ns.ShapeSelect, ns.BaseSelect);
/**
* For the shape select tool, you just need to click one time to create a selection.
* So we jsut need to implement onSelectStart_ (no need for onSelect_ & onSelectEnd_)
* @override
*/
ns.ShapeSelect.prototype.onSelectStart_ = function (col, row, color, frame, overlay) {
// Clean previous selection:
$.publish(Events.SELECTION_DISMISSED);
// From the pixel cliked, get shape using an algorithm similar to the paintbucket one:
var pixels = pskl.PixelUtils.getSimilarConnectedPixelsFromFrame(frame, col, row);
var selection = new pskl.selection.ShapeSelection(pixels);
$.publish(Events.SELECTION_CREATED, [selection]);
};
})();

View File

@ -1,571 +0,0 @@
/**
* This class lets you encode animated GIF files
* Base class : http://www.java2s.com/Code/Java/2D-Graphics-GUI/AnimatedGifEncoder.htm
* @author Kevin Weiner (original Java version - kweiner@fmsware.com)
* @author Thibault Imbert (AS3 version - bytearray.org)
* @version 0.1 AS3 implementation
*/
//import flash.utils.ByteArray;
//import flash.display.BitmapData;
//import flash.display.Bitmap;
//import org.bytearray.gif.encoder.NeuQuant
//import flash.net.URLRequestHeader;
//import flash.net.URLRequestMethod;
//import flash.net.URLRequest;
//import flash.net.navigateToURL;
GIFEncoder = function()
{
for(var i = 0, chr = {}; i < 256; i++)
chr[i] = String.fromCharCode(i);
function ByteArray(){
this.bin = [];
}
ByteArray.prototype.getData = function(){
for(var v = '', l = this.bin.length, i = 0; i < l; i++)
v += chr[this.bin[i]];
return v;
}
ByteArray.prototype.writeByte = function(val){
this.bin.push(val);
}
ByteArray.prototype.writeUTFBytes = function(string){
for(var l = string.length, i = 0; i < l; i++)
this.writeByte(string.charCodeAt(i));
}
ByteArray.prototype.writeBytes = function(array, offset, length){
for(var l = length || array.length, i = offset||0; i < l; i++)
this.writeByte(array[i]);
}
var exports = {};
/*private*/ var width/*int*/ // image size
/*private*/ var height/*int*/;
/*private*/ var transparent/***/ = null; // transparent color if given
/*private*/ var transIndex/*int*/; // transparent index in color table
/*private*/ var repeat/*int*/ = -1; // no repeat
/*private*/ var delay/*int*/ = 0; // frame delay (hundredths)
/*private*/ var started/*Boolean*/ = false; // ready to output frames
/*private*/ var out/*ByteArray*/;
/*private*/ var image/*Bitmap*/; // current frame
/*private*/ var pixels/*ByteArray*/; // BGR byte array from frame
/*private*/ var indexedPixels/*ByteArray*/ // converted frame indexed to palette
/*private*/ var colorDepth/*int*/; // number of bit planes
/*private*/ var colorTab/*ByteArray*/; // RGB palette
/*private*/ var usedEntry/*Array*/ = new Array; // active palette entries
/*private*/ var palSize/*int*/ = 7; // color table size (bits-1)
/*private*/ var dispose/*int*/ = -1; // disposal code (-1 = use default)
/*private*/ var closeStream/*Boolean*/ = false; // close stream when finished
/*private*/ var firstFrame/*Boolean*/ = true;
/*private*/ var sizeSet/*Boolean*/ = false; // if false, get size from first frame
/*private*/ var sample/*int*/ = 10; // default sample interval for quantizer
/**
* Sets the delay time between each frame, or changes it for subsequent frames
* (applies to last frame added)
* int delay time in milliseconds
* @param ms
*/
var setDelay = exports.setDelay = function setDelay(ms/*int*/)/*void*/
{
delay = Math.round(ms / 10);
}
/**
* Sets the GIF frame disposal code for the last added frame and any
*
* subsequent frames. Default is 0 if no transparent color has been set,
* otherwise 2.
* @param code
* int disposal code.
*/
var setDispose = exports.setDispose = function setDispose(code/*int*/)/*void*/
{
if (code >= 0) dispose = code;
}
/**
* Sets the number of times the set of GIF frames should be played. Default is
* 1; 0 means play indefinitely. Must be invoked before the first image is
* added.
*
* @param iter
* int number of iterations.
* @return
*/
var setRepeat = exports.setRepeat = function setRepeat(iter/*int*/)/*void*/
{
if (iter >= 0) repeat = iter;
}
/**
* Sets the transparent color for the last added frame and any subsequent
* frames. Since all colors are subject to modification in the quantization
* process, the color in the final palette for each frame closest to the given
* color becomes the transparent color for that frame. May be set to null to
* indicate no transparent color.
* @param
* Color to be treated as transparent on display.
*/
var setTransparent = exports.setTransparent = function setTransparent(c/*Number*/)/*void*/
{
transparent = c;
}
/**
* The addFrame method takes an incoming BitmapData object to create each frames
* @param
* BitmapData object to be treated as a GIF's frame
*/
var addFrame = exports.addFrame = function addFrame(im/*BitmapData*/, is_imageData)/*Boolean*/
{
if ((im == null) || !started || out == null)
{
throw new Error ("Please call start method before calling addFrame");
return false;
}
var ok/*Boolean*/ = true;
try {
if(!is_imageData){
image = im.getImageData(0,0, im.canvas.width, im.canvas.height).data;
if (!sizeSet) setSize(im.canvas.width, im.canvas.height);
}else{
image = im;
}
getImagePixels(); // convert to correct format if necessary
analyzePixels(); // build color table & map pixels
if (firstFrame)
{
writeLSD(); // logical screen descriptior
writePalette(); // global color table
if (repeat >= 0)
{
// use NS app extension to indicate reps
writeNetscapeExt();
}
}
writeGraphicCtrlExt(); // write graphic control extension
writeImageDesc(); // image descriptor
if (!firstFrame) writePalette(); // local color table
writePixels(); // encode and write pixel data
firstFrame = false;
} catch (e/*Error*/) {
ok = false;
}
return ok;
}
/**
* Adds final trailer to the GIF stream, if you don't call the finish method
* the GIF stream will not be valid.
*/
var finish = exports.finish = function finish()/*Boolean*/
{
if (!started) return false;
var ok/*Boolean*/ = true;
started = false;
try {
out.writeByte(0x3b); // gif trailer
} catch (e/*Error*/) {
ok = false;
}
return ok;
}
/**
* Resets some members so that a new stream can be started.
* This method is actually called by the start method
*/
var reset = function reset ( )/*void*/
{
// reset for subsequent use
transIndex = 0;
image = null;
pixels = null;
indexedPixels = null;
colorTab = null;
closeStream = false;
firstFrame = true;
}
/**
* * Sets frame rate in frames per second. Equivalent to
* <code>setDelay(1000/fps)</code>.
* @param fps
* float frame rate (frames per second)
*/
var setFrameRate = exports.setFrameRate = function setFrameRate(fps/*Number*/)/*void*/
{
if (fps != 0xf) delay = Math.round(100/fps);
}
/**
* Sets quality of color quantization (conversion of images to the maximum 256
* colors allowed by the GIF specification). Lower values (minimum = 1)
* produce better colors, but slow processing significantly. 10 is the
* default, and produces good color mapping at reasonable speeds. Values
* greater than 20 do not yield significant improvements in speed.
* @param quality
* int greater than 0.
* @return
*/
var setQuality = exports.setQuality = function setQuality(quality/*int*/)/*void*/
{
if (quality < 1) quality = 1;
sample = quality;
}
/**
* Sets the GIF frame size. The default size is the size of the first frame
* added if this method is not invoked.
* @param w
* int frame width.
* @param h
* int frame width.
*/
var setSize = exports.setSize = function setSize(w/*int*/, h/*int*/)/*void*/
{
if (started && !firstFrame) return;
width = w;
height = h;
if (width < 1)width = 320;
if (height < 1)height = 240;
sizeSet = true
}
/**
* Initiates GIF file creation on the given stream.
* @param os
* OutputStream on which GIF images are written.
* @return false if initial write failed.
*
*/
var start = exports.start = function start()/*Boolean*/
{
reset();
var ok/*Boolean*/ = true;
closeStream = false;
out = new ByteArray;
try {
out.writeUTFBytes("GIF89a"); // header
} catch (e/*Error*/) {
ok = false;
}
return started = ok;
}
var cont = exports.cont = function cont()/*Boolean*/
{
reset();
var ok/*Boolean*/ = true;
closeStream = false;
out = new ByteArray;
return started = ok;
}
/**
* Analyzes image colors and creates color map.
*/
var analyzePixels = function analyzePixels()/*void*/
{
var len/*int*/ = pixels.length;
var nPix/*int*/ = len / 3;
indexedPixels = [];
var nq/*NeuQuant*/ = new NeuQuant(pixels, len, sample);
// initialize quantizer
colorTab = nq.process(); // create reduced palette
// map image pixels to new palette
var k/*int*/ = 0;
for (var j/*int*/ = 0; j < nPix; j++) {
var index/*int*/ = nq.map(pixels[k++] & 0xff, pixels[k++] & 0xff, pixels[k++] & 0xff);
usedEntry[index] = true;
indexedPixels[j] = index;
}
pixels = null;
colorDepth = 8;
palSize = 7;
// get closest match to transparent color if specified
if (transparent != null) {
transIndex = findClosest(transparent);
var r = colorTab[transIndex*3];
var g = colorTab[transIndex*3+1];
var b = colorTab[transIndex*3+2];
var trans_indices = [];
for (var i=0; i<colorTab.length; i+=3)
{
var index = i / 3;
if (!usedEntry[index]) continue;
if (colorTab[i] == r && colorTab[i+1] == g && colorTab[i+2] == b)
trans_indices.push(index);
}
for (var i=0; i<indexedPixels.length; i++) {
if (trans_indices.indexOf(indexedPixels[i]) >= 0) {
indexedPixels[i] = transIndex;
}
}
}
}
/**
* Returns index of palette color closest to c
*
*/
var findClosest = function findClosest(c/*Number*/)/*int*/
{
if (colorTab == null) return -1;
var r/*int*/ = (c & 0xFF0000) >> 16;
var g/*int*/ = (c & 0x00FF00) >> 8;
var b/*int*/ = (c & 0x0000FF);
var minpos/*int*/ = 0;
var dmin/*int*/ = 256 * 256 * 256;
var len/*int*/ = colorTab.length;
for (var i/*int*/ = 0; i < len;) {
var dr/*int*/ = r - (colorTab[i++] & 0xff);
var dg/*int*/ = g - (colorTab[i++] & 0xff);
var db/*int*/ = b - (colorTab[i] & 0xff);
var d/*int*/ = dr * dr + dg * dg + db * db;
var index/*int*/ = i / 3;
if (usedEntry[index] && (d < dmin)) {
dmin = d;
minpos = index;
}
i++;
}
return minpos;
}
/**
* Extracts image pixels into byte array "pixels
*/
var getImagePixels = function getImagePixels()/*void*/
{
var w/*int*/ = width;
var h/*int*/ = height;
pixels = [];
var data = image;
var count/*int*/ = 0;
for ( var i/*int*/ = 0; i < h; i++ )
{
for (var j/*int*/ = 0; j < w; j++ )
{
var b = (i*w*4)+j*4;
pixels[count++] = data[b];
pixels[count++] = data[b+1];
pixels[count++] = data[b+2];
}
}
}
/**
* Writes Graphic Control Extension
*/
var writeGraphicCtrlExt = function writeGraphicCtrlExt()/*void*/
{
out.writeByte(0x21); // extension introducer
out.writeByte(0xf9); // GCE label
out.writeByte(4); // data block size
var transp/*int*/
var disp/*int*/;
if (transparent == null) {
transp = 0;
disp = 0; // dispose = no action
} else {
transp = 1;
disp = 2; // force clear if using transparent color
}
if (dispose >= 0) {
disp = dispose & 7; // user override
}
disp <<= 2;
// packed fields
out.writeByte(0 | // 1:3 reserved
disp | // 4:6 disposal
0 | // 7 user input - 0 = none
transp); // 8 transparency flag
WriteShort(delay); // delay x 1/100 sec
out.writeByte(transIndex); // transparent color index
out.writeByte(0); // block terminator
}
/**
* Writes Image Descriptor
*/
var writeImageDesc = function writeImageDesc()/*void*/
{
out.writeByte(0x2c); // image separator
WriteShort(0); // image position x,y = 0,0
WriteShort(0);
WriteShort(width); // image size
WriteShort(height);
// packed fields
if (firstFrame) {
// no LCT - GCT is used for first (or only) frame
out.writeByte(0);
} else {
// specify normal LCT
out.writeByte(0x80 | // 1 local color table 1=yes
0 | // 2 interlace - 0=no
0 | // 3 sorted - 0=no
0 | // 4-5 reserved
palSize); // 6-8 size of color table
}
}
/**
* Writes Logical Screen Descriptor
*/
var writeLSD = function writeLSD()/*void*/
{
// logical screen size
WriteShort(width);
WriteShort(height);
// packed fields
out.writeByte((0x80 | // 1 : global color table flag = 1 (gct used)
0x70 | // 2-4 : color resolution = 7
0x00 | // 5 : gct sort flag = 0
palSize)); // 6-8 : gct size
out.writeByte(0); // background color index
out.writeByte(0); // pixel aspect ratio - assume 1:1
}
/**
* Writes Netscape application extension to define repeat count.
*/
var writeNetscapeExt = function writeNetscapeExt()/*void*/
{
out.writeByte(0x21); // extension introducer
out.writeByte(0xff); // app extension label
out.writeByte(11); // block size
out.writeUTFBytes("NETSCAPE" + "2.0"); // app id + auth code
out.writeByte(3); // sub-block size
out.writeByte(1); // loop sub-block id
WriteShort(repeat); // loop count (extra iterations, 0=repeat forever)
out.writeByte(0); // block terminator
}
/**
* Writes color table
*/
var writePalette = function writePalette()/*void*/
{
out.writeBytes(colorTab);
var n/*int*/ = (3 * 256) - colorTab.length;
for (var i/*int*/ = 0; i < n; i++) out.writeByte(0);
}
var WriteShort = function WriteShort (pValue/*int*/)/*void*/
{
out.writeByte( pValue & 0xFF );
out.writeByte( (pValue >> 8) & 0xFF);
}
/**
* Encodes and writes pixel data
*/
var writePixels = function writePixels()/*void*/
{
var myencoder/*LZWEncoder*/ = new LZWEncoder(width, height, indexedPixels, colorDepth);
myencoder.encode(out);
}
/**
* retrieves the GIF stream
*/
var stream = exports.stream = function stream ( )/*ByteArray*/
{
return out;
}
var setProperties = exports.setProperties = function setProperties(has_start, is_first){
started = has_start;
firstFrame = is_first;
//out = new ByteArray; //??
}
return exports
}

View File

@ -1,328 +0,0 @@
/**
* This class handles LZW encoding
* Adapted from Jef Poskanzer's Java port by way of J. M. G. Elliott.
* @author Kevin Weiner (original Java version - kweiner@fmsware.com)
* @author Thibault Imbert (AS3 version - bytearray.org)
* @version 0.1 AS3 implementation
*/
//import flash.utils.ByteArray;
LZWEncoder = function()
{
var exports = {};
/*private_static*/ var EOF/*int*/ = -1;
/*private*/ var imgW/*int*/;
/*private*/ var imgH/*int*/
/*private*/ var pixAry/*ByteArray*/;
/*private*/ var initCodeSize/*int*/;
/*private*/ var remaining/*int*/;
/*private*/ var curPixel/*int*/;
// GIFCOMPR.C - GIF Image compression routines
// Lempel-Ziv compression based on 'compress'. GIF modifications by
// David Rowley (mgardi@watdcsu.waterloo.edu)
// General DEFINEs
/*private_static*/ var BITS/*int*/ = 12;
/*private_static*/ var HSIZE/*int*/ = 5003; // 80% occupancy
// GIF Image compression - modified 'compress'
// Based on: compress.c - File compression ala IEEE Computer, June 1984.
// By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas)
// Jim McKie (decvax!mcvax!jim)
// Steve Davies (decvax!vax135!petsd!peora!srd)
// Ken Turkowski (decvax!decwrl!turtlevax!ken)
// James A. Woods (decvax!ihnp4!ames!jaw)
// Joe Orost (decvax!vax135!petsd!joe)
/*private*/ var n_bits/*int*/ // number of bits/code
/*private*/ var maxbits/*int*/ = BITS; // user settable max # bits/code
/*private*/ var maxcode/*int*/ // maximum code, given n_bits
/*private*/ var maxmaxcode/*int*/ = 1 << BITS; // should NEVER generate this code
/*private*/ var htab/*Array*/ = new Array;
/*private*/ var codetab/*Array*/ = new Array;
/*private*/ var hsize/*int*/ = HSIZE; // for dynamic table sizing
/*private*/ var free_ent/*int*/ = 0; // first unused entry
// block compression parameters -- after all codes are used up,
// and compression rate changes, start over.
/*private*/ var clear_flg/*Boolean*/ = false;
// Algorithm: use open addressing double hashing (no chaining) on the
// prefix code / next character combination. We do a variant of Knuth's
// algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime
// secondary probe. Here, the modular division first probe is gives way
// to a faster exclusive-or manipulation. Also do block compression with
// an adaptive reset, whereby the code table is cleared when the compression
// ratio decreases, but after the table fills. The variable-length output
// codes are re-sized at this point, and a special CLEAR code is generated
// for the decompressor. Late addition: construct the table according to
// file size for noticeable speed improvement on small files. Please direct
// questions about this implementation to ames!jaw.
/*private*/ var g_init_bits/*int*/;
/*private*/ var ClearCode/*int*/;
/*private*/ var EOFCode/*int*/;
// output
// Output the given code.
// Inputs:
// code: A n_bits-bit integer. If == -1, then EOF. This assumes
// that n_bits =< wordsize - 1.
// Outputs:
// Outputs code to the file.
// Assumptions:
// Chars are 8 bits long.
// Algorithm:
// Maintain a BITS character long buffer (so that 8 codes will
// fit in it exactly). Use the VAX insv instruction to insert each
// code in turn. When the buffer fills up empty it and start over.
/*private*/ var cur_accum/*int*/ = 0;
/*private*/ var cur_bits/*int*/ = 0;
/*private*/ var masks/*Array*/ = [ 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF ];
// Number of characters so far in this 'packet'
/*private*/ var a_count/*int*/;
// Define the storage for the packet accumulator
/*private*/ var accum/*ByteArray*/ = [];
var LZWEncoder = exports.LZWEncoder = function LZWEncoder (width/*int*/, height/*int*/, pixels/*ByteArray*/, color_depth/*int*/)
{
imgW = width;
imgH = height;
pixAry = pixels;
initCodeSize = Math.max(2, color_depth);
}
// Add a character to the end of the current packet, and if it is 254
// characters, flush the packet to disk.
var char_out = function char_out(c/*Number*/, outs/*ByteArray*/)/*void*/
{
accum[a_count++] = c;
if (a_count >= 254) flush_char(outs);
}
// Clear out the hash table
// table clear for block compress
var cl_block = function cl_block(outs/*ByteArray*/)/*void*/
{
cl_hash(hsize);
free_ent = ClearCode + 2;
clear_flg = true;
output(ClearCode, outs);
}
// reset code table
var cl_hash = function cl_hash(hsize/*int*/)/*void*/
{
for (var i/*int*/ = 0; i < hsize; ++i) htab[i] = -1;
}
var compress = exports.compress = function compress(init_bits/*int*/, outs/*ByteArray*/)/*void*/
{
var fcode/*int*/;
var i/*int*/ /* = 0 */;
var c/*int*/;
var ent/*int*/;
var disp/*int*/;
var hsize_reg/*int*/;
var hshift/*int*/;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (init_bits - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0; // clear packet
ent = nextPixel();
hshift = 0;
for (fcode = hsize; fcode < 65536; fcode *= 2)
++hshift;
hshift = 8 - hshift; // set hash code range bound
hsize_reg = hsize;
cl_hash(hsize_reg); // clear hash table
output(ClearCode, outs);
outer_loop: while ((c = nextPixel()) != EOF)
{
fcode = (c << maxbits) + ent;
i = (c << hshift) ^ ent; // xor hashing
if (htab[i] == fcode)
{
ent = codetab[i];
continue;
} else if (htab[i] >= 0) // non-empty slot
{
disp = hsize_reg - i; // secondary hash (after G. Knott)
if (i == 0)
disp = 1;
do
{
if ((i -= disp) < 0) i += hsize_reg;
if (htab[i] == fcode)
{
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, outs);
ent = c;
if (free_ent < maxmaxcode)
{
codetab[i] = free_ent++; // code -> hashtable
htab[i] = fcode;
} else cl_block(outs);
}
// Put out the final code.
output(ent, outs);
output(EOFCode, outs);
}
// ----------------------------------------------------------------------------
var encode = exports.encode = function encode(os/*ByteArray*/)/*void*/
{
os.writeByte(initCodeSize); // write "initial code size" byte
remaining = imgW * imgH; // reset navigation variables
curPixel = 0;
compress(initCodeSize + 1, os); // compress and write the pixel data
os.writeByte(0); // write block terminator
}
// Flush the packet to disk, and reset the accumulator
var flush_char = function flush_char(outs/*ByteArray*/)/*void*/
{
if (a_count > 0)
{
outs.writeByte(a_count);
outs.writeBytes(accum, 0, a_count);
a_count = 0;
}
}
var MAXCODE = function MAXCODE(n_bits/*int*/)/*int*/
{
return (1 << n_bits) - 1;
}
// ----------------------------------------------------------------------------
// Return the next pixel from the image
// ----------------------------------------------------------------------------
var nextPixel = function nextPixel()/*int*/
{
if (remaining == 0) return EOF;
--remaining;
var pix/*Number*/ = pixAry[curPixel++];
return pix & 0xff;
}
var output = function output(code/*int*/, outs/*ByteArray*/)/*void*/
{
cur_accum &= masks[cur_bits];
if (cur_bits > 0) cur_accum |= (code << cur_bits);
else cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8)
{
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
// If the next entry is going to be too big for the code size,
// then increase it, if possible.
if (free_ent > maxcode || clear_flg)
{
if (clear_flg)
{
maxcode = MAXCODE(n_bits = g_init_bits);
clear_flg = false;
} else
{
++n_bits;
if (n_bits == maxbits) maxcode = maxmaxcode;
else maxcode = MAXCODE(n_bits);
}
}
if (code == EOFCode)
{
// At EOF, write the rest of the buffer.
while (cur_bits > 0)
{
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
flush_char(outs);
}
}
LZWEncoder.apply(this, arguments);
return exports;
}

View File

@ -1,668 +0,0 @@
/*
* NeuQuant Neural-Net Quantization Algorithm
* ------------------------------------------
*
* Copyright (c) 1994 Anthony Dekker
*
* NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See
* "Kohonen neural networks for optimal colour quantization" in "Network:
* Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of
* the algorithm.
*
* Any party obtaining a copy of these files from the author, directly or
* indirectly, is granted, free of charge, a full and unrestricted irrevocable,
* world-wide, paid up, royalty-free, nonexclusive right and license to deal in
* this software and documentation files (the "Software"), including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons who
* receive copies from any such party to do so, with the only requirement being
* that this copyright notice remain intact.
*/
/*
* This class handles Neural-Net quantization algorithm
* @author Kevin Weiner (original Java version - kweiner@fmsware.com)
* @author Thibault Imbert (AS3 version - bytearray.org)
* @version 0.1 AS3 implementation
*/
//import flash.utils.ByteArray;
NeuQuant = function()
{
var exports = {};
/*private_static*/ var netsize/*int*/ = 256; /* number of colours used */
/* four primes near 500 - assume no image has a length so large */
/* that it is divisible by all four primes */
/*private_static*/ var prime1/*int*/ = 499;
/*private_static*/ var prime2/*int*/ = 491;
/*private_static*/ var prime3/*int*/ = 487;
/*private_static*/ var prime4/*int*/ = 503;
/*private_static*/ var minpicturebytes/*int*/ = (3 * prime4);
/* minimum size for input image */
/*
* Program Skeleton ---------------- [select samplefac in range 1..30] [read
* image from input file] pic = (unsigned char*) malloc(3*width*height);
* initnet(pic,3*width*height,samplefac); learn(); unbiasnet(); [write output
* image header, using writecolourmap(f)] inxbuild(); write output image using
* inxsearch(b,g,r)
*/
/*
* Network Definitions -------------------
*/
/*private_static*/ var maxnetpos/*int*/ = (netsize - 1);
/*private_static*/ var netbiasshift/*int*/ = 4; /* bias for colour values */
/*private_static*/ var ncycles/*int*/ = 100; /* no. of learning cycles */
/* defs for freq and bias */
/*private_static*/ var intbiasshift/*int*/ = 16; /* bias for fractions */
/*private_static*/ var intbias/*int*/ = (1 << intbiasshift);
/*private_static*/ var gammashift/*int*/ = 10; /* gamma = 1024 */
/*private_static*/ var gamma/*int*/ = (1 << gammashift);
/*private_static*/ var betashift/*int*/ = 10;
/*private_static*/ var beta/*int*/ = (intbias >> betashift); /* beta = 1/1024 */
/*private_static*/ var betagamma/*int*/ = (intbias << (gammashift - betashift));
/* defs for decreasing radius factor */
/*private_static*/ var initrad/*int*/ = (netsize >> 3); /*
* for 256 cols, radius
* starts
*/
/*private_static*/ var radiusbiasshift/*int*/ = 6; /* at 32.0 biased by 6 bits */
/*private_static*/ var radiusbias/*int*/ = (1 << radiusbiasshift);
/*private_static*/ var initradius/*int*/ = (initrad * radiusbias); /*
* and
* decreases
* by a
*/
/*private_static*/ var radiusdec/*int*/ = 30; /* factor of 1/30 each cycle */
/* defs for decreasing alpha factor */
/*private_static*/ var alphabiasshift/*int*/ = 10; /* alpha starts at 1.0 */
/*private_static*/ var initalpha/*int*/ = (1 << alphabiasshift);
/*private*/ var alphadec/*int*/ /* biased by 10 bits */
/* radbias and alpharadbias used for radpower calculation */
/*private_static*/ var radbiasshift/*int*/ = 8;
/*private_static*/ var radbias/*int*/ = (1 << radbiasshift);
/*private_static*/ var alpharadbshift/*int*/ = (alphabiasshift + radbiasshift);
/*private_static*/ var alpharadbias/*int*/ = (1 << alpharadbshift);
/*
* Types and Global Variables --------------------------
*/
/*private*/ var thepicture/*ByteArray*//* the input image itself */
/*private*/ var lengthcount/*int*/; /* lengthcount = H*W*3 */
/*private*/ var samplefac/*int*/; /* sampling factor 1..30 */
// typedef int pixel[4]; /* BGRc */
/*private*/ var network/*Array*/; /* the network itself - [netsize][4] */
/*protected*/ var netindex/*Array*/ = new Array();
/* for network lookup - really 256 */
/*private*/ var bias/*Array*/ = new Array();
/* bias and freq arrays for learning */
/*private*/ var freq/*Array*/ = new Array();
/*private*/ var radpower/*Array*/ = new Array();
var NeuQuant = exports.NeuQuant = function NeuQuant(thepic/*ByteArray*/, len/*int*/, sample/*int*/)
{
var i/*int*/;
var p/*Array*/;
thepicture = thepic;
lengthcount = len;
samplefac = sample;
network = new Array(netsize);
for (i = 0; i < netsize; i++)
{
network[i] = new Array(4);
p = network[i];
p[0] = p[1] = p[2] = (i << (netbiasshift + 8)) / netsize;
freq[i] = intbias / netsize; /* 1/netsize */
bias[i] = 0;
}
}
var colorMap = function colorMap()/*ByteArray*/
{
var map/*ByteArray*/ = [];
var index/*Array*/ = new Array(netsize);
for (var i/*int*/ = 0; i < netsize; i++)
index[network[i][3]] = i;
var k/*int*/ = 0;
for (var l/*int*/ = 0; l < netsize; l++) {
var j/*int*/ = index[l];
map[k++] = (network[j][0]);
map[k++] = (network[j][1]);
map[k++] = (network[j][2]);
}
return map;
}
/*
* Insertion sort of network and building of netindex[0..255] (to do after
* unbias)
* -------------------------------------------------------------------------------
*/
var inxbuild = function inxbuild()/*void*/
{
var i/*int*/;
var j/*int*/;
var smallpos/*int*/;
var smallval/*int*/;
var p/*Array*/;
var q/*Array*/;
var previouscol/*int*/
var startpos/*int*/
previouscol = 0;
startpos = 0;
for (i = 0; i < netsize; i++)
{
p = network[i];
smallpos = i;
smallval = p[1]; /* index on g */
/* find smallest in i..netsize-1 */
for (j = i + 1; j < netsize; j++)
{
q = network[j];
if (q[1] < smallval)
{ /* index on g */
smallpos = j;
smallval = q[1]; /* index on g */
}
}
q = network[smallpos];
/* swap p (i) and q (smallpos) entries */
if (i != smallpos)
{
j = q[0];
q[0] = p[0];
p[0] = j;
j = q[1];
q[1] = p[1];
p[1] = j;
j = q[2];
q[2] = p[2];
p[2] = j;
j = q[3];
q[3] = p[3];
p[3] = j;
}
/* smallval entry is now in position i */
if (smallval != previouscol)
{
netindex[previouscol] = (startpos + i) >> 1;
for (j = previouscol + 1; j < smallval; j++) netindex[j] = i;
previouscol = smallval;
startpos = i;
}
}
netindex[previouscol] = (startpos + maxnetpos) >> 1;
for (j = previouscol + 1; j < 256; j++) netindex[j] = maxnetpos; /* really 256 */
}
/*
* Main Learning Loop ------------------
*/
var learn = function learn()/*void*/
{
var i/*int*/;
var j/*int*/;
var b/*int*/;
var g/*int*/
var r/*int*/;
var radius/*int*/;
var rad/*int*/;
var alpha/*int*/;
var step/*int*/;
var delta/*int*/;
var samplepixels/*int*/;
var p/*ByteArray*/;
var pix/*int*/;
var lim/*int*/;
if (lengthcount < minpicturebytes) samplefac = 1;
alphadec = 30 + ((samplefac - 1) / 3);
p = thepicture;
pix = 0;
lim = lengthcount;
samplepixels = lengthcount / (3 * samplefac);
delta = samplepixels / ncycles;
alpha = initalpha;
radius = initradius;
rad = radius >> radiusbiasshift;
if (rad <= 1) rad = 0;
for (i = 0; i < rad; i++) radpower[i] = alpha * (((rad * rad - i * i) * radbias) / (rad * rad));
if (lengthcount < minpicturebytes) step = 3;
else if ((lengthcount % prime1) != 0) step = 3 * prime1;
else
{
if ((lengthcount % prime2) != 0) step = 3 * prime2;
else
{
if ((lengthcount % prime3) != 0) step = 3 * prime3;
else step = 3 * prime4;
}
}
i = 0;
while (i < samplepixels)
{
b = (p[pix + 0] & 0xff) << netbiasshift;
g = (p[pix + 1] & 0xff) << netbiasshift;
r = (p[pix + 2] & 0xff) << netbiasshift;
j = contest(b, g, r);
altersingle(alpha, j, b, g, r);
if (rad != 0) alterneigh(rad, j, b, g, r); /* alter neighbours */
pix += step;
if (pix >= lim) pix -= lengthcount;
i++;
if (delta == 0) delta = 1;
if (i % delta == 0)
{
alpha -= alpha / alphadec;
radius -= radius / radiusdec;
rad = radius >> radiusbiasshift;
if (rad <= 1) rad = 0;
for (j = 0; j < rad; j++) radpower[j] = alpha * (((rad * rad - j * j) * radbias) / (rad * rad));
}
}
}
/*
** Search for BGR values 0..255 (after net is unbiased) and return colour
* index
* ----------------------------------------------------------------------------
*/
var map = exports.map = function map(b/*int*/, g/*int*/, r/*int*/)/*int*/
{
var i/*int*/;
var j/*int*/;
var dist/*int*/
var a/*int*/;
var bestd/*int*/;
var p/*Array*/;
var best/*int*/;
bestd = 1000; /* biggest possible dist is 256*3 */
best = -1;
i = netindex[g]; /* index on g */
j = i - 1; /* start at netindex[g] and work outwards */
while ((i < netsize) || (j >= 0))
{
if (i < netsize)
{
p = network[i];
dist = p[1] - g; /* inx key */
if (dist >= bestd) i = netsize; /* stop iter */
else
{
i++;
if (dist < 0) dist = -dist;
a = p[0] - b;
if (a < 0) a = -a;
dist += a;
if (dist < bestd)
{
a = p[2] - r;
if (a < 0) a = -a;
dist += a;
if (dist < bestd)
{
bestd = dist;
best = p[3];
}
}
}
}
if (j >= 0)
{
p = network[j];
dist = g - p[1]; /* inx key - reverse dif */
if (dist >= bestd) j = -1; /* stop iter */
else
{
j--;
if (dist < 0) dist = -dist;
a = p[0] - b;
if (a < 0) a = -a;
dist += a;
if (dist < bestd)
{
a = p[2] - r;
if (a < 0)a = -a;
dist += a;
if (dist < bestd)
{
bestd = dist;
best = p[3];
}
}
}
}
}
return (best);
}
var process = exports.process = function process()/*ByteArray*/
{
learn();
unbiasnet();
inxbuild();
return colorMap();
}
/*
* Unbias network to give byte values 0..255 and record position i to prepare
* for sort
* -----------------------------------------------------------------------------------
*/
var unbiasnet = function unbiasnet()/*void*/
{
var i/*int*/;
var j/*int*/;
for (i = 0; i < netsize; i++)
{
network[i][0] >>= netbiasshift;
network[i][1] >>= netbiasshift;
network[i][2] >>= netbiasshift;
network[i][3] = i; /* record colour no */
}
}
/*
* Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in
* radpower[|i-j|]
* ---------------------------------------------------------------------------------
*/
var alterneigh = function alterneigh(rad/*int*/, i/*int*/, b/*int*/, g/*int*/, r/*int*/)/*void*/
{
var j/*int*/;
var k/*int*/;
var lo/*int*/;
var hi/*int*/;
var a/*int*/;
var m/*int*/;
var p/*Array*/;
lo = i - rad;
if (lo < -1) lo = -1;
hi = i + rad;
if (hi > netsize) hi = netsize;
j = i + 1;
k = i - 1;
m = 1;
while ((j < hi) || (k > lo))
{
a = radpower[m++];
if (j < hi)
{
p = network[j++];
try {
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
} catch (e/*Error*/) {} // prevents 1.3 miscompilation
}
if (k > lo)
{
p = network[k--];
try
{
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
} catch (e/*Error*/) {}
}
}
}
/*
* Move neuron i towards biased (b,g,r) by factor alpha
* ----------------------------------------------------
*/
var altersingle = function altersingle(alpha/*int*/, i/*int*/, b/*int*/, g/*int*/, r/*int*/)/*void*/
{
/* alter hit neuron */
var n/*Array*/ = network[i];
n[0] -= (alpha * (n[0] - b)) / initalpha;
n[1] -= (alpha * (n[1] - g)) / initalpha;
n[2] -= (alpha * (n[2] - r)) / initalpha;
}
/*
* Search for biased BGR values ----------------------------
*/
var contest = function contest(b/*int*/, g/*int*/, r/*int*/)/*int*/
{
/* finds closest neuron (min dist) and updates freq */
/* finds best neuron (min dist-bias) and returns position */
/* for frequently chosen neurons, freq[i] is high and bias[i] is negative */
/* bias[i] = gamma*((1/netsize)-freq[i]) */
var i/*int*/;
var dist/*int*/;
var a/*int*/;
var biasdist/*int*/;
var betafreq/*int*/;
var bestpos/*int*/;
var bestbiaspos/*int*/;
var bestd/*int*/;
var bestbiasd/*int*/;
var n/*Array*/;
bestd = ~(1 << 31);
bestbiasd = bestd;
bestpos = -1;
bestbiaspos = bestpos;
for (i = 0; i < netsize; i++)
{
n = network[i];
dist = n[0] - b;
if (dist < 0) dist = -dist;
a = n[1] - g;
if (a < 0) a = -a;
dist += a;
a = n[2] - r;
if (a < 0) a = -a;
dist += a;
if (dist < bestd)
{
bestd = dist;
bestpos = i;
}
biasdist = dist - ((bias[i]) >> (intbiasshift - netbiasshift));
if (biasdist < bestbiasd)
{
bestbiasd = biasdist;
bestbiaspos = i;
}
betafreq = (freq[i] >> betashift);
freq[i] -= betafreq;
bias[i] += (betafreq << gammashift);
}
freq[bestpos] += beta;
bias[bestpos] -= betagamma;
return (bestbiaspos);
}
NeuQuant.apply(this, arguments);
return exports;
}

View File

@ -1,18 +0,0 @@
function encode64(input) {
var output = "", i = 0, l = input.length,
key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
chr1, chr2, chr3, enc1, enc2, enc3, enc4;
while (i < l) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) enc3 = enc4 = 64;
else if (isNaN(chr3)) enc4 = 64;
output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);
}
return output;
}

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

View File

@ -1,12 +0,0 @@
<html>
<head>
<title>jscolor demo</title>
</head>
<body>
<script type="text/javascript" src="jscolor.js"></script>
Click here: <input class="color" value="66ff00">
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1,953 +0,0 @@
/**
* jscolor, JavaScript Color Picker
*
* @version 1.4.0
* @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
* @author Jan Odvarko, http://odvarko.cz
* @created 2008-06-15
* @updated 2012-07-06
* @link http://jscolor.com
*/
var jscolor = {
dir : '', // location of jscolor directory (leave empty to autodetect)
bindClass : 'color', // class name
binding : true, // automatic binding via <input class="...">
preloading : true, // use image preloading?
install : function() {
jscolor.addEvent(window, 'load', jscolor.init);
},
init : function() {
if(jscolor.binding) {
jscolor.bind();
}
if(jscolor.preloading) {
jscolor.preload();
}
},
getDir : function() {
if(!jscolor.dir) {
var detected = jscolor.detectDir();
jscolor.dir = detected!==false ? detected : 'jscolor/';
}
return jscolor.dir;
},
detectDir : function() {
var base = location.href;
var e = document.getElementsByTagName('base');
for(var i=0; i<e.length; i+=1) {
if(e[i].href) { base = e[i].href; }
}
var e = document.getElementsByTagName('script');
for(var i=0; i<e.length; i+=1) {
if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
var src = new jscolor.URI(e[i].src);
var srcAbs = src.toAbsolute(base);
srcAbs.path = srcAbs.path.replace(/[^\/]+$/, ''); // remove filename
srcAbs.query = null;
srcAbs.fragment = null;
return srcAbs.toString();
}
}
return false;
},
bind : function() {
var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i');
var e = document.getElementsByTagName('input');
for(var i=0; i<e.length; i+=1) {
var m;
if(!e[i].color && e[i].className && (m = e[i].className.match(matchClass))) {
var prop = {};
if(m[3]) {
try {
prop = (new Function ('return (' + m[3] + ')'))();
} catch(eInvalidProp) {}
}
e[i].color = new jscolor.color(e[i], prop);
}
}
},
preload : function() {
for(var fn in jscolor.imgRequire) {
if(jscolor.imgRequire.hasOwnProperty(fn)) {
jscolor.loadImage(fn);
}
}
},
images : {
pad : [ 181, 101 ],
sld : [ 16, 101 ],
cross : [ 15, 15 ],
arrow : [ 7, 11 ]
},
imgRequire : {},
imgLoaded : {},
requireImage : function(filename) {
jscolor.imgRequire[filename] = true;
},
loadImage : function(filename) {
if(!jscolor.imgLoaded[filename]) {
jscolor.imgLoaded[filename] = new Image();
jscolor.imgLoaded[filename].src = jscolor.getDir()+filename;
}
},
fetchElement : function(mixed) {
return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
},
addEvent : function(el, evnt, func) {
if(el.addEventListener) {
el.addEventListener(evnt, func, false);
} else if(el.attachEvent) {
el.attachEvent('on'+evnt, func);
}
},
fireEvent : function(el, evnt) {
if(!el) {
return;
}
if(document.createEvent) {
var ev = document.createEvent('HTMLEvents');
ev.initEvent(evnt, true, true);
el.dispatchEvent(ev);
} else if(document.createEventObject) {
var ev = document.createEventObject();
el.fireEvent('on'+evnt, ev);
} else if(el['on'+evnt]) { // alternatively use the traditional event model (IE5)
el['on'+evnt]();
}
},
getElementPos : function(e) {
var e1=e, e2=e;
var x=0, y=0;
if(e1.offsetParent) {
do {
x += e1.offsetLeft;
y += e1.offsetTop;
} while(e1 = e1.offsetParent);
}
while((e2 = e2.parentNode) && e2.nodeName.toUpperCase() !== 'BODY') {
x -= e2.scrollLeft;
y -= e2.scrollTop;
}
return [x, y];
},
getElementSize : function(e) {
return [e.offsetWidth, e.offsetHeight];
},
getRelMousePos : function(e) {
var x = 0, y = 0;
if (!e) { e = window.event; }
if (typeof e.offsetX === 'number') {
x = e.offsetX;
y = e.offsetY;
} else if (typeof e.layerX === 'number') {
x = e.layerX;
y = e.layerY;
}
return { x: x, y: y };
},
getViewPos : function() {
if(typeof window.pageYOffset === 'number') {
return [window.pageXOffset, window.pageYOffset];
} else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
return [document.body.scrollLeft, document.body.scrollTop];
} else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
} else {
return [0, 0];
}
},
getViewSize : function() {
if(typeof window.innerWidth === 'number') {
return [window.innerWidth, window.innerHeight];
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
return [document.body.clientWidth, document.body.clientHeight];
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
return [document.documentElement.clientWidth, document.documentElement.clientHeight];
} else {
return [0, 0];
}
},
URI : function(uri) { // See RFC3986
this.scheme = null;
this.authority = null;
this.path = '';
this.query = null;
this.fragment = null;
this.parse = function(uri) {
var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
this.scheme = m[3] ? m[2] : null;
this.authority = m[5] ? m[6] : null;
this.path = m[7];
this.query = m[9] ? m[10] : null;
this.fragment = m[12] ? m[13] : null;
return this;
};
this.toString = function() {
var result = '';
if(this.scheme !== null) { result = result + this.scheme + ':'; }
if(this.authority !== null) { result = result + '//' + this.authority; }
if(this.path !== null) { result = result + this.path; }
if(this.query !== null) { result = result + '?' + this.query; }
if(this.fragment !== null) { result = result + '#' + this.fragment; }
return result;
};
this.toAbsolute = function(base) {
var base = new jscolor.URI(base);
var r = this;
var t = new jscolor.URI;
if(base.scheme === null) { return false; }
if(r.scheme !== null && r.scheme.toLowerCase() === base.scheme.toLowerCase()) {
r.scheme = null;
}
if(r.scheme !== null) {
t.scheme = r.scheme;
t.authority = r.authority;
t.path = removeDotSegments(r.path);
t.query = r.query;
} else {
if(r.authority !== null) {
t.authority = r.authority;
t.path = removeDotSegments(r.path);
t.query = r.query;
} else {
if(r.path === '') {
t.path = base.path;
if(r.query !== null) {
t.query = r.query;
} else {
t.query = base.query;
}
} else {
if(r.path.substr(0,1) === '/') {
t.path = removeDotSegments(r.path);
} else {
if(base.authority !== null && base.path === '') {
t.path = '/'+r.path;
} else {
t.path = base.path.replace(/[^\/]+$/,'')+r.path;
}
t.path = removeDotSegments(t.path);
}
t.query = r.query;
}
t.authority = base.authority;
}
t.scheme = base.scheme;
}
t.fragment = r.fragment;
return t;
};
function removeDotSegments(path) {
var out = '';
while(path) {
if(path.substr(0,3)==='../' || path.substr(0,2)==='./') {
path = path.replace(/^\.+/,'').substr(1);
} else if(path.substr(0,3)==='/./' || path==='/.') {
path = '/'+path.substr(3);
} else if(path.substr(0,4)==='/../' || path==='/..') {
path = '/'+path.substr(4);
out = out.replace(/\/?[^\/]*$/, '');
} else if(path==='.' || path==='..') {
path = '';
} else {
var rm = path.match(/^\/?[^\/]*/)[0];
path = path.substr(rm.length);
out = out + rm;
}
}
return out;
}
if(uri) {
this.parse(uri);
}
},
/*
* Usage example:
* var myColor = new jscolor.color(myInputElement)
*/
color : function(target, prop) {
this.required = true; // refuse empty values?
this.adjust = true; // adjust value to uniform notation?
this.hash = false; // prefix color with # symbol?
this.caps = true; // uppercase?
this.slider = true; // show the value/saturation slider?
this.valueElement = target; // value holder
this.styleElement = target; // where to reflect current color
this.onImmediateChange = null; // onchange callback (can be either string or function)
this.hsv = [0, 0, 1]; // read-only 0-6, 0-1, 0-1
this.rgb = [1, 1, 1]; // read-only 0-1, 0-1, 0-1
this.minH = 0; // read-only 0-6
this.maxH = 6; // read-only 0-6
this.minS = 0; // read-only 0-1
this.maxS = 1; // read-only 0-1
this.minV = 0; // read-only 0-1
this.maxV = 1; // read-only 0-1
this.pickerOnfocus = true; // display picker on focus?
this.pickerMode = 'HSV'; // HSV | HVS
this.pickerPosition = 'bottom'; // left | right | top | bottom
this.pickerSmartPosition = true; // automatically adjust picker position when necessary
this.pickerButtonHeight = 20; // px
this.pickerClosable = false;
this.pickerCloseText = 'Close';
this.pickerButtonColor = 'ButtonText'; // px
this.pickerFace = 10; // px
this.pickerFaceColor = 'ThreeDFace'; // CSS color
this.pickerBorder = 1; // px
this.pickerBorderColor = 'ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight'; // CSS color
this.pickerInset = 1; // px
this.pickerInsetColor = 'ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow'; // CSS color
this.pickerZIndex = 10000;
for(var p in prop) {
if(prop.hasOwnProperty(p)) {
this[p] = prop[p];
}
}
this.hidePicker = function() {
if(isPickerOwner()) {
removePicker();
}
};
this.showPicker = function() {
if(!isPickerOwner()) {
var tp = jscolor.getElementPos(target); // target pos
var ts = jscolor.getElementSize(target); // target size
var vp = jscolor.getViewPos(); // view pos
var vs = jscolor.getViewSize(); // view size
var ps = getPickerDims(this); // picker size
var a, b, c;
switch(this.pickerPosition.toLowerCase()) {
case 'left': a=1; b=0; c=-1; break;
case 'right':a=1; b=0; c=1; break;
case 'top': a=0; b=1; c=-1; break;
default: a=0; b=1; c=1; break;
}
var l = (ts[b]+ps[b])/2;
// picker pos
if (!this.pickerSmartPosition) {
var pp = [
tp[a],
tp[b]+ts[b]-l+l*c
];
} else {
var pp = [
-vp[a]+tp[a]+ps[a] > vs[a] ?
(-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
tp[a],
-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
(-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
(tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
];
}
drawPicker(pp[a], pp[b]);
}
};
this.importColor = function() {
if(!valueElement) {
this.exportColor();
} else {
if(!this.adjust) {
if(!this.fromString(valueElement.value, leaveValue)) {
styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
styleElement.style.color = styleElement.jscStyle.color;
this.exportColor(leaveValue | leaveStyle);
}
} else if(!this.required && /^\s*$/.test(valueElement.value)) {
valueElement.value = '';
styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
styleElement.style.color = styleElement.jscStyle.color;
this.exportColor(leaveValue | leaveStyle);
} else if(this.fromString(valueElement.value)) {
// OK
} else {
this.exportColor();
}
}
};
this.exportColor = function(flags) {
if(!(flags & leaveValue) && valueElement) {
var value = this.toString();
if(this.caps) { value = value.toUpperCase(); }
if(this.hash) { value = '#'+value; }
valueElement.value = value;
}
if(!(flags & leaveStyle) && styleElement) {
styleElement.style.backgroundImage = "none";
styleElement.style.backgroundColor =
'#'+this.toString();
styleElement.style.color =
0.213 * this.rgb[0] +
0.715 * this.rgb[1] +
0.072 * this.rgb[2]
< 0.5 ? '#FFF' : '#000';
}
if(!(flags & leavePad) && isPickerOwner()) {
redrawPad();
}
if(!(flags & leaveSld) && isPickerOwner()) {
redrawSld();
}
};
this.fromHSV = function(h, s, v, flags) { // null = don't change
if(h !== null) { h = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, h)); }
if(s !== null) { s = Math.max(0.0, this.minS, Math.min(1.0, this.maxS, s)); }
if(v !== null) { v = Math.max(0.0, this.minV, Math.min(1.0, this.maxV, v)); }
this.rgb = HSV_RGB(
h===null ? this.hsv[0] : (this.hsv[0]=h),
s===null ? this.hsv[1] : (this.hsv[1]=s),
v===null ? this.hsv[2] : (this.hsv[2]=v)
);
this.exportColor(flags);
};
this.fromRGB = function(r, g, b, flags) { // null = don't change
if(r !== null) { r = Math.max(0.0, Math.min(1.0, r)); }
if(g !== null) { g = Math.max(0.0, Math.min(1.0, g)); }
if(b !== null) { b = Math.max(0.0, Math.min(1.0, b)); }
var hsv = RGB_HSV(
r===null ? this.rgb[0] : r,
g===null ? this.rgb[1] : g,
b===null ? this.rgb[2] : b
);
if(hsv[0] !== null) {
this.hsv[0] = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, hsv[0]));
}
if(hsv[2] !== 0) {
this.hsv[1] = hsv[1]===null ? null : Math.max(0.0, this.minS, Math.min(1.0, this.maxS, hsv[1]));
}
this.hsv[2] = hsv[2]===null ? null : Math.max(0.0, this.minV, Math.min(1.0, this.maxV, hsv[2]));
// update RGB according to final HSV, as some values might be trimmed
var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]);
this.rgb[0] = rgb[0];
this.rgb[1] = rgb[1];
this.rgb[2] = rgb[2];
this.exportColor(flags);
};
this.fromString = function(hex, flags) {
var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
if(!m) {
return false;
} else {
if(m[1].length === 6) { // 6-char notation
this.fromRGB(
parseInt(m[1].substr(0,2),16) / 255,
parseInt(m[1].substr(2,2),16) / 255,
parseInt(m[1].substr(4,2),16) / 255,
flags
);
} else { // 3-char notation
this.fromRGB(
parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
flags
);
}
return true;
}
};
this.toString = function() {
return (
(0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
(0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
(0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
);
};
function RGB_HSV(r, g, b) {
var n = Math.min(Math.min(r,g),b);
var v = Math.max(Math.max(r,g),b);
var m = v - n;
if(m === 0) { return [ null, 0, v ]; }
var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
return [ h===6?0:h, m/v, v ];
}
function HSV_RGB(h, s, v) {
if(h === null) { return [ v, v, v ]; }
var i = Math.floor(h);
var f = i%2 ? h-i : 1-(h-i);
var m = v * (1 - s);
var n = v * (1 - s*f);
switch(i) {
case 6:
case 0: return [v,n,m];
case 1: return [n,v,m];
case 2: return [m,v,n];
case 3: return [m,n,v];
case 4: return [n,m,v];
case 5: return [v,m,n];
}
}
function removePicker() {
delete jscolor.picker.owner;
document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
}
function drawPicker(x, y) {
if(!jscolor.picker) {
jscolor.picker = {
box : document.createElement('div'),
boxB : document.createElement('div'),
pad : document.createElement('div'),
padB : document.createElement('div'),
padM : document.createElement('div'),
sld : document.createElement('div'),
sldB : document.createElement('div'),
sldM : document.createElement('div'),
btn : document.createElement('div'),
btnS : document.createElement('span'),
btnT : document.createTextNode(THIS.pickerCloseText)
};
for(var i=0,segSize=4; i<jscolor.images.sld[1]; i+=segSize) {
var seg = document.createElement('div');
seg.style.height = segSize+'px';
seg.style.fontSize = '1px';
seg.style.lineHeight = '0';
jscolor.picker.sld.appendChild(seg);
}
jscolor.picker.sldB.appendChild(jscolor.picker.sld);
jscolor.picker.box.appendChild(jscolor.picker.sldB);
jscolor.picker.box.appendChild(jscolor.picker.sldM);
jscolor.picker.padB.appendChild(jscolor.picker.pad);
jscolor.picker.box.appendChild(jscolor.picker.padB);
jscolor.picker.box.appendChild(jscolor.picker.padM);
jscolor.picker.btnS.appendChild(jscolor.picker.btnT);
jscolor.picker.btn.appendChild(jscolor.picker.btnS);
jscolor.picker.box.appendChild(jscolor.picker.btn);
jscolor.picker.boxB.appendChild(jscolor.picker.box);
}
var p = jscolor.picker;
// controls interaction
p.box.onmouseup =
p.box.onmouseout = function() { target.focus(); };
p.box.onmousedown = function() { abortBlur=true; };
p.box.onmousemove = function(e) {
if (holdPad || holdSld) {
holdPad && setPad(e);
holdSld && setSld(e);
if (document.selection) {
document.selection.empty();
} else if (window.getSelection) {
window.getSelection().removeAllRanges();
}
dispatchImmediateChange();
}
};
p.padM.onmouseup =
p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
p.padM.onmousedown = function(e) {
// if the slider is at the bottom, move it up
switch(modeID) {
case 0: if (THIS.hsv[2] === 0) { THIS.fromHSV(null, null, 1.0); }; break;
case 1: if (THIS.hsv[1] === 0) { THIS.fromHSV(null, 1.0, null); }; break;
}
holdPad=true;
setPad(e);
dispatchImmediateChange();
};
p.sldM.onmouseup =
p.sldM.onmouseout = function() { if(holdSld) { holdSld=false; jscolor.fireEvent(valueElement,'change'); } };
p.sldM.onmousedown = function(e) {
holdSld=true;
setSld(e);
dispatchImmediateChange();
};
// picker
var dims = getPickerDims(THIS);
p.box.style.width = dims[0] + 'px';
p.box.style.height = dims[1] + 'px';
// picker border
p.boxB.style.position = 'absolute';
p.boxB.style.clear = 'both';
p.boxB.style.left = x+'px';
p.boxB.style.top = y+'px';
p.boxB.style.zIndex = THIS.pickerZIndex;
p.boxB.style.border = THIS.pickerBorder+'px solid';
p.boxB.style.borderColor = THIS.pickerBorderColor;
p.boxB.style.background = THIS.pickerFaceColor;
// pad image
p.pad.style.width = jscolor.images.pad[0]+'px';
p.pad.style.height = jscolor.images.pad[1]+'px';
// pad border
p.padB.style.position = 'absolute';
p.padB.style.left = THIS.pickerFace+'px';
p.padB.style.top = THIS.pickerFace+'px';
p.padB.style.border = THIS.pickerInset+'px solid';
p.padB.style.borderColor = THIS.pickerInsetColor;
// pad mouse area
p.padM.style.position = 'absolute';
p.padM.style.left = '0';
p.padM.style.top = '0';
p.padM.style.width = THIS.pickerFace + 2*THIS.pickerInset + jscolor.images.pad[0] + jscolor.images.arrow[0] + 'px';
p.padM.style.height = p.box.style.height;
p.padM.style.cursor = 'crosshair';
// slider image
p.sld.style.overflow = 'hidden';
p.sld.style.width = jscolor.images.sld[0]+'px';
p.sld.style.height = jscolor.images.sld[1]+'px';
// slider border
p.sldB.style.display = THIS.slider ? 'block' : 'none';
p.sldB.style.position = 'absolute';
p.sldB.style.right = THIS.pickerFace+'px';
p.sldB.style.top = THIS.pickerFace+'px';
p.sldB.style.border = THIS.pickerInset+'px solid';
p.sldB.style.borderColor = THIS.pickerInsetColor;
// slider mouse area
p.sldM.style.display = THIS.slider ? 'block' : 'none';
p.sldM.style.position = 'absolute';
p.sldM.style.right = '0';
p.sldM.style.top = '0';
p.sldM.style.width = jscolor.images.sld[0] + jscolor.images.arrow[0] + THIS.pickerFace + 2*THIS.pickerInset + 'px';
p.sldM.style.height = p.box.style.height;
try {
p.sldM.style.cursor = 'pointer';
} catch(eOldIE) {
p.sldM.style.cursor = 'hand';
}
// "close" button
function setBtnBorder() {
var insetColors = THIS.pickerInsetColor.split(/\s+/);
var pickerOutsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1];
p.btn.style.borderColor = pickerOutsetColor;
}
p.btn.style.display = THIS.pickerClosable ? 'block' : 'none';
p.btn.style.position = 'absolute';
p.btn.style.left = THIS.pickerFace + 'px';
p.btn.style.bottom = THIS.pickerFace + 'px';
p.btn.style.padding = '0 15px';
p.btn.style.height = '18px';
p.btn.style.border = THIS.pickerInset + 'px solid';
setBtnBorder();
p.btn.style.color = THIS.pickerButtonColor;
p.btn.style.font = '12px sans-serif';
p.btn.style.textAlign = 'center';
try {
p.btn.style.cursor = 'pointer';
} catch(eOldIE) {
p.btn.style.cursor = 'hand';
}
p.btn.onmousedown = function () {
THIS.hidePicker();
};
p.btnS.style.lineHeight = p.btn.style.height;
// load images in optimal order
switch(modeID) {
case 0: var padImg = 'hs.png'; break;
case 1: var padImg = 'hv.png'; break;
}
p.padM.style.backgroundImage = "url('"+jscolor.getDir()+"cross.gif')";
p.padM.style.backgroundRepeat = "no-repeat";
p.sldM.style.backgroundImage = "url('"+jscolor.getDir()+"arrow.gif')";
p.sldM.style.backgroundRepeat = "no-repeat";
p.pad.style.backgroundImage = "url('"+jscolor.getDir()+padImg+"')";
p.pad.style.backgroundRepeat = "no-repeat";
p.pad.style.backgroundPosition = "0 0";
// place pointers
redrawPad();
redrawSld();
jscolor.picker.owner = THIS;
document.getElementsByTagName('body')[0].appendChild(p.boxB);
}
function getPickerDims(o) {
var dims = [
2*o.pickerInset + 2*o.pickerFace + jscolor.images.pad[0] +
(o.slider ? 2*o.pickerInset + 2*jscolor.images.arrow[0] + jscolor.images.sld[0] : 0),
o.pickerClosable ?
4*o.pickerInset + 3*o.pickerFace + jscolor.images.pad[1] + o.pickerButtonHeight :
2*o.pickerInset + 2*o.pickerFace + jscolor.images.pad[1]
];
return dims;
}
function redrawPad() {
// redraw the pad pointer
switch(modeID) {
case 0: var yComponent = 1; break;
case 1: var yComponent = 2; break;
}
var x = Math.round((THIS.hsv[0]/6) * (jscolor.images.pad[0]-1));
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.pad[1]-1));
jscolor.picker.padM.style.backgroundPosition =
(THIS.pickerFace+THIS.pickerInset+x - Math.floor(jscolor.images.cross[0]/2)) + 'px ' +
(THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.cross[1]/2)) + 'px';
// redraw the slider image
var seg = jscolor.picker.sld.childNodes;
switch(modeID) {
case 0:
var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 1);
for(var i=0; i<seg.length; i+=1) {
seg[i].style.backgroundColor = 'rgb('+
(rgb[0]*(1-i/seg.length)*100)+'%,'+
(rgb[1]*(1-i/seg.length)*100)+'%,'+
(rgb[2]*(1-i/seg.length)*100)+'%)';
}
break;
case 1:
var rgb, s, c = [ THIS.hsv[2], 0, 0 ];
var i = Math.floor(THIS.hsv[0]);
var f = i%2 ? THIS.hsv[0]-i : 1-(THIS.hsv[0]-i);
switch(i) {
case 6:
case 0: rgb=[0,1,2]; break;
case 1: rgb=[1,0,2]; break;
case 2: rgb=[2,0,1]; break;
case 3: rgb=[2,1,0]; break;
case 4: rgb=[1,2,0]; break;
case 5: rgb=[0,2,1]; break;
}
for(var i=0; i<seg.length; i+=1) {
s = 1 - 1/(seg.length-1)*i;
c[1] = c[0] * (1 - s*f);
c[2] = c[0] * (1 - s);
seg[i].style.backgroundColor = 'rgb('+
(c[rgb[0]]*100)+'%,'+
(c[rgb[1]]*100)+'%,'+
(c[rgb[2]]*100)+'%)';
}
break;
}
}
function redrawSld() {
// redraw the slider pointer
switch(modeID) {
case 0: var yComponent = 2; break;
case 1: var yComponent = 1; break;
}
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.sld[1]-1));
jscolor.picker.sldM.style.backgroundPosition =
'0 ' + (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.arrow[1]/2)) + 'px';
}
function isPickerOwner() {
return jscolor.picker && jscolor.picker.owner === THIS;
}
function blurTarget() {
if(valueElement === target) {
THIS.importColor();
}
if(THIS.pickerOnfocus) {
THIS.hidePicker();
}
}
function blurValue() {
if(valueElement !== target) {
THIS.importColor();
}
}
function setPad(e) {
var mpos = jscolor.getRelMousePos(e);
var x = mpos.x - THIS.pickerFace - THIS.pickerInset;
var y = mpos.y - THIS.pickerFace - THIS.pickerInset;
switch(modeID) {
case 0: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), 1 - y/(jscolor.images.pad[1]-1), null, leaveSld); break;
case 1: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), null, 1 - y/(jscolor.images.pad[1]-1), leaveSld); break;
}
}
function setSld(e) {
var mpos = jscolor.getRelMousePos(e);
var y = mpos.y - THIS.pickerFace - THIS.pickerInset;
switch(modeID) {
case 0: THIS.fromHSV(null, null, 1 - y/(jscolor.images.sld[1]-1), leavePad); break;
case 1: THIS.fromHSV(null, 1 - y/(jscolor.images.sld[1]-1), null, leavePad); break;
}
}
function dispatchImmediateChange() {
if (THIS.onImmediateChange) {
var callback;
if (typeof THIS.onImmediateChange === 'string') {
callback = new Function (THIS.onImmediateChange);
} else {
callback = THIS.onImmediateChange;
}
callback.call(THIS);
}
}
var THIS = this;
var modeID = this.pickerMode.toLowerCase()==='hvs' ? 1 : 0;
var abortBlur = false;
var
valueElement = jscolor.fetchElement(this.valueElement),
styleElement = jscolor.fetchElement(this.styleElement);
var
holdPad = false,
holdSld = false;
var
leaveValue = 1<<0,
leaveStyle = 1<<1,
leavePad = 1<<2,
leaveSld = 1<<3;
// target
jscolor.addEvent(target, 'focus', function() {
if(THIS.pickerOnfocus) { THIS.showPicker(); }
});
jscolor.addEvent(target, 'blur', function() {
if(!abortBlur) {
window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur=false; }, 0);
} else {
abortBlur = false;
}
});
// valueElement
if(valueElement) {
var updateField = function() {
THIS.fromString(valueElement.value, leaveValue);
dispatchImmediateChange();
};
jscolor.addEvent(valueElement, 'keyup', updateField);
jscolor.addEvent(valueElement, 'input', updateField);
jscolor.addEvent(valueElement, 'blur', blurValue);
valueElement.setAttribute('autocomplete', 'off');
}
// styleElement
if(styleElement) {
styleElement.jscStyle = {
backgroundImage : styleElement.style.backgroundImage,
backgroundColor : styleElement.style.backgroundColor,
color : styleElement.style.color
};
}
// require images
switch(modeID) {
case 0: jscolor.requireImage('hs.png'); break;
case 1: jscolor.requireImage('hv.png'); break;
}
jscolor.requireImage('cross.gif');
jscolor.requireImage('arrow.gif');
this.importColor();
}
};
jscolor.install();

View File

@ -1,118 +0,0 @@
(function () {
var ns = $.namespace("pskl.model");
ns.Frame = function (pixels) {
this.pixels = pixels;
this.previousStates = [this.getPixels()];
this.stateIndex = 0;
};
ns.Frame.createEmpty = function (width, height) {
var pixels = ns.Frame.createEmptyPixelGrid_(width, height);
return new ns.Frame(pixels);
};
ns.Frame.createEmptyPixelGrid_ = function (width, height) {
var pixels = []; //new Array(width);
for (var columnIndex=0; columnIndex < width; columnIndex++) {
var columnArray = [];
for(var heightIndex = 0; heightIndex < height; heightIndex++) {
columnArray.push(Constants.TRANSPARENT_COLOR);
}
pixels[columnIndex] = columnArray;
}
return pixels;
};
ns.Frame.createEmptyFromFrame = function (frame) {
return ns.Frame.createEmpty(frame.getWidth(), frame.getHeight());
};
ns.Frame.prototype.clone = function () {
return new ns.Frame(this.getPixels());
};
/**
* Returns a copy of the pixels used by the frame
*/
ns.Frame.prototype.getPixels = function () {
return this.clonePixels_(this.pixels);
};
/**
* Copies the passed pixels into the frame.
*/
ns.Frame.prototype.setPixels = function (pixels) {
this.pixels = this.clonePixels_(pixels);
};
ns.Frame.prototype.clear = function () {
var pixels = ns.Frame.createEmptyPixelGrid_(this.getWidth(), this.getHeight());
this.setPixels(pixels);
};
/**
* Clone a set of pixels. Should be static utility method
* @private
*/
ns.Frame.prototype.clonePixels_ = function (pixels) {
var clonedPixels = [];
for (var col = 0 ; col < pixels.length ; col++) {
clonedPixels[col] = pixels[col].slice(0 , pixels[col].length);
}
return clonedPixels;
};
ns.Frame.prototype.serialize = function () {
return JSON.stringify(this.pixels);
};
ns.Frame.prototype.setPixel = function (col, row, color) {
this.pixels[col][row] = color;
};
ns.Frame.prototype.getPixel = function (col, row) {
return this.pixels[col][row];
};
ns.Frame.prototype.getWidth = function () {
return this.pixels.length;
};
ns.Frame.prototype.getHeight = function () {
return this.pixels[0].length;
};
ns.Frame.prototype.containsPixel = function (col, row) {
return col >= 0 && row >= 0 && col < this.pixels.length && row < this.pixels[0].length;
};
ns.Frame.prototype.saveState = function () {
// remove all states past current state
this.previousStates.length = this.stateIndex + 1;
// push new state
this.previousStates.push(this.getPixels());
// set the stateIndex to latest saved state
this.stateIndex = this.previousStates.length - 1;
};
ns.Frame.prototype.loadPreviousState = function () {
if (this.stateIndex > 0) {
this.stateIndex--;
this.setPixels(this.previousStates[this.stateIndex]);
}
};
ns.Frame.prototype.loadNextState = function () {
if (this.stateIndex < this.previousStates.length - 1) {
this.stateIndex++;
this.setPixels(this.previousStates[this.stateIndex]);
}
};
ns.Frame.prototype.isSameSize = function (otherFrame) {
return this.getHeight() == otherFrame.getHeight() && this.getWidth() == otherFrame.getWidth();
};
})();

View File

@ -1,157 +0,0 @@
(function () {
var ns = $.namespace("pskl.model");
ns.FrameSheet = function (height, width) {
this.width = width;
this.height = height;
this.frames = [];
this.currentFrameIndex = 0;
};
ns.FrameSheet.prototype.getHeight = function () {
return this.height;
};
ns.FrameSheet.prototype.getWidth = function () {
return this.width;
};
ns.FrameSheet.prototype.addEmptyFrame = function () {
this.addFrame(ns.Frame.createEmpty(this.width, this.height));
};
ns.FrameSheet.prototype.addFrame = function (frame) {
this.frames.push(frame);
};
ns.FrameSheet.prototype.getFrameCount = function () {
return this.frames.length;
};
ns.FrameSheet.prototype.getCurrentFrame = function () {
return this.frames[this.currentFrameIndex];
};
ns.FrameSheet.prototype.setCurrentFrameIndex = function (index) {
this.currentFrameIndex = index;
$.publish(Events.CURRENT_FRAME_SET, [this.getCurrentFrame()]);
$.publish(Events.FRAMESHEET_RESET); // Is it no to overkill to have this here ?
};
ns.FrameSheet.prototype.getUsedColors = function() {
var colors = {};
for (var frameIndex=0; frameIndex < this.frames.length; frameIndex++) {
var frame = this.frames[frameIndex];
for (var i = 0, width = frame.getWidth(); i < width ; i++) {
var line = frame[i];
for (var j = 0, height = frame.getHeight() ; j < height ; j++) {
var pixel = frame.getPixel(i, j);
colors[pixel] = pixel;
}
}
}
return colors;
};
// Could be used to pass around model using long GET param (good enough for simple models) and
// do some temporary locastorage
ns.FrameSheet.prototype.serialize = function() {
var serializedFrames = [];
for (var i = 0 ; i < this.frames.length ; i++) {
serializedFrames.push(this.frames[i].serialize());
}
return '[' + serializedFrames.join(",") + ']';
//return JSON.stringify(frames);
};
/**
* Load a framesheet from a model that might have been persisted in db / localstorage
* Overrides existing frames.
* @param {String} serialized
*/
ns.FrameSheet.prototype.deserialize = function (serialized) {
try {
this.load(JSON.parse(serialized));
} catch (e) {
throw "Could not load serialized framesheet : " + e.message;
}
};
/**
* Load a framesheet from a model that might have been persisted in db / localstorage
* Overrides existing frames.
* @param {String} serialized
*/
ns.FrameSheet.prototype.load = function (framesheet) {
this.frames = [];
for (var i = 0 ; i < framesheet.length ; i++) {
var frameCfg = framesheet[i];
this.addFrame(new ns.Frame(frameCfg));
}
if (this.hasFrameAtIndex(0)) {
this.height = this.getFrameByIndex(0).getHeight();
this.width = this.getFrameByIndex(0).getWidth();
this.setCurrentFrameIndex(0);
$.publish(Events.FRAME_SIZE_CHANGED);
}
$.publish(Events.FRAMESHEET_RESET);
};
ns.FrameSheet.prototype.hasFrameAtIndex = function(index) {
return (index >= 0 && index < this.getFrameCount());
};
ns.FrameSheet.prototype.getFrameByIndex = function(index) {
if (isNaN(index)) {
throw "Bad argument value for getFrameByIndex method: <" + index + ">";
}
if (!this.hasFrameAtIndex(index)) {
throw "Out of bound index for frameSheet object.";
}
return this.frames[index];
};
ns.FrameSheet.prototype.removeFrameByIndex = function(index) {
if(!this.hasFrameAtIndex(index)) {
throw "Out of bound index for frameSheet object.";
}
this.frames.splice(index, 1);
// Current frame index might not be valid anymore
if (!this.hasFrameAtIndex(this.currentFrameIndex)) {
// if not select last frame available
this.setCurrentFrameIndex(this.getFrameCount() - 1);
}
$.publish(Events.FRAMESHEET_RESET);
};
ns.FrameSheet.prototype.duplicateFrameByIndex = function(index) {
var frame = this.getFrameByIndex(index);
this.frames.splice(index + 1, 0, frame.clone());
};
ns.FrameSheet.prototype.moveFrame = function(originIndex, destinationIndex) {
this.frames.splice(destinationIndex, 0, this.frames.splice(originIndex, 1)[0]);
};
ns.FrameSheet.prototype.swapFrames = function(indexFrame1, indexFrame2) {
if(isNaN(indexFrame1) || isNaN(indexFrame1) ||
(!this.hasFrameAtIndex(indexFrame1) && !this.hasFrameAtIndex(indexFrame2))) {
throw "Bad indexes for swapFrames Framesheet function.";
}
if(indexFrame1 == indexFrame2) {
return;
}
else {
var swapFrame = this.frames[indexFrame1];
this.frames[indexFrame1] = this.frames[indexFrame2];
this.frames[indexFrame2] = swapFrame;
}
};
})();

View File

@ -1,248 +0,0 @@
/**
* @require Constants
* @require Events
*/
(function () {
var ns = $.namespace("pskl");
/**
* FrameSheetModel instance.
*/
var frameSheet;
/**
* Main application controller
*/
ns.app = {
init : function () {
var frameSize = this.readSizeFromURL_();
frameSheet = new pskl.model.FrameSheet(frameSize.height, frameSize.width);
frameSheet.addEmptyFrame();
/**
* True when piskel is running in static mode (no back end needed).
* When started from APP Engine, appEngineToken_ (Boolean) should be set on window.pskl
*/
this.isStaticVersion = !pskl.appEngineToken_;
this.drawingController = new pskl.controller.DrawingController(frameSheet, $('#drawing-canvas-container'));
this.animationController = new pskl.controller.AnimatedPreviewController(frameSheet, $('#preview-canvas-container'));
this.previewsController = new pskl.controller.PreviewFilmController(frameSheet, $('#preview-list'));
this.settingsController = new pskl.controller.SettingsController();
// To catch the current active frame, the selection manager have to be initialized before
// the 'frameSheet.setCurrentFrameIndex(0);' line below.
// TODO(vincz): Slice each constructor to have:
// - an event(s) listening init
// - an event(s) triggering init
// All listeners will be hook in a first step, then all event triggering inits will be called
// in a second batch.
this.selectionManager = new pskl.selection.SelectionManager(frameSheet, this.drawingController.overlayFrame);
// DO NOT MOVE THIS LINE (see comment above)
frameSheet.setCurrentFrameIndex(0);
this.animationController.init();
this.previewsController.init();
this.settingsController.init();
this.historyService = new pskl.service.HistoryService(frameSheet);
this.historyService.init();
this.keyboardEventService = new pskl.service.KeyboardEventService();
this.keyboardEventService.init();
this.notificationController = new pskl.controller.NotificationController();
this.notificationController.init();
this.localStorageService = new pskl.service.LocalStorageService(frameSheet);
this.localStorageService.init();
if (this.isStaticVersion) {
var framesheetId = this.readFramesheetIdFromURL_();
if (framesheetId) {
$.publish(Events.SHOW_NOTIFICATION, [{"content": "Loading animation with id : [" + framesheetId + "]"}]);
this.loadFramesheetFromService(framesheetId);
} else {
this.finishInit();
this.localStorageService.displayRestoreNotification();
}
} else {
if (pskl.framesheetData_) {
frameSheet.load(pskl.framesheetData_);
}
this.finishInit();
}
var drawingLoop = new pskl.rendering.DrawingLoop();
drawingLoop.addCallback(this.render, this);
drawingLoop.start();
// Init (event-delegated) bootstrap tooltips:
$('body').tooltip({
selector: '[rel=tooltip]'
});
},
render : function (delta) {
this.drawingController.render(delta);
this.animationController.render(delta);
this.previewsController.render(delta);
},
finishInit : function () {
var toolController = new pskl.controller.ToolController();
toolController.init();
var paletteController = new pskl.controller.PaletteController();
paletteController.init(frameSheet);
},
readSizeFromURL_ : function () {
var sizeParam = this.readUrlParameter_("size"), size;
// parameter expected as size=64x48 => size=widthxheight
var parts = sizeParam.split("x");
if (parts && parts.length == 2 && !isNaN(parts[0]) && !isNaN(parts[1])) {
var width = parseInt(parts[0], 10),
height = parseInt(parts[1], 10);
size = {
height : Math.min(height, Constants.MAX_HEIGHT),
width : Math.min(width, Constants.MAX_WIDTH)
};
} else {
size = Constants.DEFAULT_SIZE;
}
return size;
},
readFramesheetIdFromURL_ : function() {
return this.readUrlParameter_("frameId");
},
readUrlParameter_ : function (paramName) {
var searchString = window.location.search.substring(1),
i, val, params = searchString.split("&");
for (i=0;i<params.length;i++) {
val = params[i].split("=");
if (val[0] == paramName) {
return unescape(val[1]);
}
}
return "";
},
loadFramesheetFromService : function (frameId) {
var xhr = new XMLHttpRequest();
xhr.open('GET', Constants.PISKEL_SERVICE_URL + '/get?l=' + frameId, true);
xhr.responseType = 'text';
xhr.onload = function(e) {
var res = JSON.parse(this.responseText);
frameSheet.load(res.framesheet);
pskl.app.animationController.setFPS(res.fps);
$.publish(Events.HIDE_NOTIFICATION);
pskl.app.finishInit();
};
xhr.onerror = function () {
$.publish(Events.HIDE_NOTIFICATION);
pskl.app.finishInit();
};
xhr.send();
},
getFirstFrameAsPNGData_ : function () {
var tmpSheet = new pskl.model.FrameSheet(frameSheet.getWidth(), frameSheet.getHeight());
tmpSheet.addFrame(frameSheet.getFrameByIndex(0));
return (new pskl.rendering.SpritesheetRenderer(tmpSheet)).renderAsImageDataSpritesheetPNG();
},
// TODO(julz): Create package ?
storeSheet : function (event) {
var xhr = new XMLHttpRequest();
var formData = new FormData();
formData.append('framesheet_content', frameSheet.serialize());
formData.append('fps_speed', $('#preview-fps').val());
if (this.isStaticVersion) {
// anonymous save on old app-engine backend
xhr.open('POST', Constants.PISKEL_SERVICE_URL + "/store", true);
} else {
// additional values only used with latest app-engine backend
formData.append('name', $('#piskel-name').val());
formData.append('frames', frameSheet.getFrameCount());
// Get image/png data for first frame
formData.append('preview', this.getFirstFrameAsPNGData_());
xhr.open('POST', "save", true);
}
xhr.onload = function(e) {
if (this.status == 200) {
if (pskl.app.isStaticVersion) {
var baseUrl = window.location.href.replace(window.location.search, "");
window.location.href = baseUrl + "?frameId=" + this.responseText;
} else {
$.publish(Events.SHOW_NOTIFICATION, [{"content": "Successfully saved !"}]);
}
} else {
this.onerror(e);
}
};
xhr.onerror = function(e) {
$.publish(Events.SHOW_NOTIFICATION, [{"content": "Saving failed ("+this.status+")"}]);
};
xhr.send(formData);
if(event) {
event.stopPropagation();
event.preventDefault();
}
return false;
},
uploadToScreenletstore : function(imageData) {
var xhr = new XMLHttpRequest();
var formData = new FormData();
formData.append('data', imageData);
xhr.open('POST', "http://screenletstore.appspot.com/__/upload", true);
var cloudURL;
var that = this;
xhr.onload = function(e) {
if (this.status == 200) {
cloudURL = "http://screenletstore.appspot.com/img/" + this.responseText;
that.openWindow(cloudURL);
}
};
xhr.send(formData);
},
uploadAsAnimatedGIF : function () {
var fps = pskl.app.animationController.fps;
var imageData = (new pskl.rendering.SpritesheetRenderer(frameSheet)).renderAsImageDataAnimatedGIF(fps);
this.uploadToScreenletstore(imageData);
},
uploadAsSpritesheetPNG : function () {
var imageData = (new pskl.rendering.SpritesheetRenderer(frameSheet)).renderAsImageDataSpritesheetPNG();
this.uploadToScreenletstore(imageData);
},
openWindow: function(url) {
var options = [
"dialog=yes", "scrollbars=no", "status=no",
"width=" + frameSheet.getWidth() * frameSheet.getFrameCount(),
"height=" + frameSheet.getHeight()
].join(",");
window.open(url, "piskel-export", options);
}
};
pskl.app.init();
})();

View File

@ -1,36 +0,0 @@
(function () {
var ns = $.namespace("pskl.rendering");
ns.CanvasRenderer = function (frame, dpi) {
this.frame = frame;
this.dpi = dpi;
};
ns.CanvasRenderer.prototype.render = function (frame, dpi) {
var canvas = this.createCanvas_();
var context = canvas.getContext('2d');
for(var col = 0, width = this.frame.getWidth(); col < width; col++) {
for(var row = 0, height = this.frame.getHeight(); row < height; row++) {
var color = this.frame.getPixel(col, row);
this.renderPixel_(color, col, row, context);
}
}
return context;
};
ns.CanvasRenderer.prototype.renderPixel_ = function (color, col, row, context) {
if(color == Constants.TRANSPARENT_COLOR) {
color = "#FFF";
}
context.fillStyle = color;
context.fillRect(col * this.dpi, row * this.dpi, this.dpi, this.dpi);
};
ns.CanvasRenderer.prototype.createCanvas_ = function () {
var width = this.frame.getWidth() * this.dpi;
var height = this.frame.getHeight() * this.dpi;
return pskl.CanvasUtils.createCanvas(width, height);
};
})();

View File

@ -1,61 +0,0 @@
(function () {
var ns = $.namespace("pskl.rendering");
ns.DrawingLoop = function () {
this.requestAnimationFrame = this.getRequestAnimationFrameShim_();
this.isRunning = false;
this.previousTime = 0;
this.callbacks = [];
};
ns.DrawingLoop.prototype.addCallback = function (callback, scope, args) {
var callbackObj = {
fn : callback,
scope : scope,
args : args
};
this.callbacks.push(callbackObj);
return callbackObj;
};
ns.DrawingLoop.prototype.removeCallback = function (callbackObj) {
var index = this.callbacks.indexOf(callbackObj);
if (index != -1) {
this.callbacks.splice(index, 1);
}
};
ns.DrawingLoop.prototype.start = function () {
this.isRunning = true;
this.loop_();
};
ns.DrawingLoop.prototype.loop_ = function () {
var currentTime = Date.now();
var delta = currentTime - this.previousTime;
this.executeCallbacks_(delta);
this.previousTime = currentTime;
this.requestAnimationFrame.call(window, this.loop_.bind(this));
};
ns.DrawingLoop.prototype.executeCallbacks_ = function (deltaTime) {
for (var i = 0 ; i < this.callbacks.length ; i++) {
var cb = this.callbacks[i];
cb.fn.call(cb.scope, deltaTime, cb.args);
}
};
ns.DrawingLoop.prototype.stop = function () {
this.isRunning = false;
};
ns.DrawingLoop.prototype.getRequestAnimationFrameShim_ = function () {
var requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) { window.setTimeout(callback, 1000/60); };
return requestAnimationFrame;
};
})();

View File

@ -1,165 +0,0 @@
(function () {
var ns = $.namespace("pskl.rendering");
ns.FrameRenderer = function (container, renderingOptions, className) {
this.defaultRenderingOptions = {
'supportGridRendering' : false
};
renderingOptions = $.extend(true, {}, this.defaultRenderingOptions, renderingOptions);
if(container === undefined) {
throw 'Bad FrameRenderer initialization. <container> undefined.';
}
if(isNaN(renderingOptions.dpi)) {
throw 'Bad FrameRenderer initialization. <dpi> not well defined.';
}
this.container = container;
this.dpi = renderingOptions.dpi;
this.className = className;
this.canvas = null;
this.supportGridRendering = renderingOptions.supportGridRendering;
this.enableGrid(pskl.UserSettings.get(pskl.UserSettings.SHOW_GRID));
// Flag to know if the config was altered
this.canvasConfigDirty = true;
this.updateBackgroundClass_(pskl.UserSettings.get(pskl.UserSettings.CANVAS_BACKGROUND));
$.subscribe(Events.USER_SETTINGS_CHANGED, $.proxy(this.onUserSettingsChange_, this));
};
ns.FrameRenderer.prototype.init = function (frame) {
this.render(frame);
this.lastRenderedFrame = frame;
};
ns.FrameRenderer.prototype.updateDPI = function (newDPI) {
this.dpi = newDPI;
this.canvasConfigDirty = true;
};
/**
* @private
*/
ns.FrameRenderer.prototype.onUserSettingsChange_ = function (evt, settingName, settingValue) {
if(settingName == pskl.UserSettings.SHOW_GRID) {
this.enableGrid(settingValue);
}
else if (settingName == pskl.UserSettings.CANVAS_BACKGROUND) {
this.updateBackgroundClass_(settingValue);
}
};
/**
* @private
*/
ns.FrameRenderer.prototype.updateBackgroundClass_ = function (newClass) {
var currentClass = this.container.data('current-background-class');
if (currentClass) {
this.container.removeClass(currentClass);
}
this.container.addClass(newClass);
this.container.data('current-background-class', newClass);
};
ns.FrameRenderer.prototype.enableGrid = function (flag) {
this.gridStrokeWidth = (flag && this.supportGridRendering) ? Constants.GRID_STROKE_WIDTH : 0;
this.canvasConfigDirty = true;
};
ns.FrameRenderer.prototype.render = function (frame) {
this.clear(frame);
var context = this.getCanvas_(frame).getContext('2d');
for(var col = 0, width = frame.getWidth(); col < width; col++) {
for(var row = 0, height = frame.getHeight(); row < height; row++) {
var color = frame.getPixel(col, row);
this.renderPixel_(color, col, row, context);
}
}
this.lastRenderedFrame = frame;
};
ns.FrameRenderer.prototype.renderPixel_ = function (color, col, row, context) {
if(color != Constants.TRANSPARENT_COLOR) {
context.fillStyle = color;
context.fillRect(this.getFramePos_(col), this.getFramePos_(row), this.dpi, this.dpi);
}
};
ns.FrameRenderer.prototype.clear = function (frame) {
var canvas = this.getCanvas_(frame);
canvas.getContext("2d").clearRect(0, 0, canvas.width, canvas.height);
};
/**
* Transform a screen pixel-based coordinate (relative to the top-left corner of the rendered
* frame) into a sprite coordinate in column and row.
* @public
*/
ns.FrameRenderer.prototype.convertPixelCoordinatesIntoSpriteCoordinate = function(coords) {
var cellSize = this.dpi + this.gridStrokeWidth;
return {
"col" : (coords.x - coords.x % cellSize) / cellSize,
"row" : (coords.y - coords.y % cellSize) / cellSize
};
};
/**
* @private
*/
ns.FrameRenderer.prototype.getFramePos_ = function(index) {
return index * this.dpi + ((index - 1) * this.gridStrokeWidth);
};
/**
* @private
*/
ns.FrameRenderer.prototype.drawGrid_ = function(canvas, width, height, col, row) {
var ctx = canvas.getContext("2d");
ctx.lineWidth = Constants.GRID_STROKE_WIDTH;
ctx.strokeStyle = Constants.GRID_STROKE_COLOR;
for(var c=1; c < col; c++) {
ctx.moveTo(this.getFramePos_(c), 0);
ctx.lineTo(this.getFramePos_(c), height);
ctx.stroke();
}
for(var r=1; r < row; r++) {
ctx.moveTo(0, this.getFramePos_(r));
ctx.lineTo(width, this.getFramePos_(r));
ctx.stroke();
}
};
/**
* @private
*/
ns.FrameRenderer.prototype.getCanvas_ = function (frame) {
if(this.canvasConfigDirty) {
$(this.canvas).remove();
var col = frame.getWidth(),
row = frame.getHeight();
var pixelWidth = col * this.dpi + this.gridStrokeWidth * (col - 1);
var pixelHeight = row * this.dpi + this.gridStrokeWidth * (row - 1);
var classes = ['canvas'];
if (this.className) {
classes.push(this.className);
}
var canvas = pskl.CanvasUtils.createCanvas(pixelWidth, pixelHeight, classes);
this.container.append(canvas);
if(this.gridStrokeWidth > 0) {
this.drawGrid_(canvas, pixelWidth, pixelHeight, col, row);
}
this.canvas = canvas;
this.canvasConfigDirty = false;
}
return this.canvas;
};
})();

View File

@ -1,63 +0,0 @@
(function () {
var ns = $.namespace("pskl.rendering");
ns.SpritesheetRenderer = function (framesheet) {
this.framesheet = framesheet;
};
ns.SpritesheetRenderer.prototype.renderAsImageDataSpritesheetPNG = function () {
var canvas = this.createCanvas_();
for (var i = 0 ; i < this.framesheet.getFrameCount() ; i++) {
var frame = this.framesheet.getFrameByIndex(i);
this.drawFrameInCanvas_(frame, canvas, i * this.framesheet.getWidth(), 0);
}
return canvas.toDataURL("image/png");
};
ns.SpritesheetRenderer.prototype.renderAsImageDataAnimatedGIF = function (fps) {
var encoder = new GIFEncoder(), dpi = 10;
encoder.setRepeat(0);
encoder.setDelay(1000/fps);
encoder.start();
encoder.setSize(this.framesheet.getWidth() * dpi, this.framesheet.getHeight() * dpi);
for (var i = 0 ; i < this.framesheet.frames.length ; i++) {
var frame = this.framesheet.frames[i];
var renderer = new pskl.rendering.CanvasRenderer(frame, dpi);
encoder.addFrame(renderer.render());
}
encoder.finish();
var imageData = 'data:image/gif;base64,' + encode64(encoder.stream().getData());
return imageData;
};
/**
* TODO(juliandescottes): Mutualize with code already present in FrameRenderer
*/
ns.SpritesheetRenderer.prototype.drawFrameInCanvas_ = function (frame, canvas, offsetWidth, offsetHeight) {
var context = canvas.getContext('2d');
for(var col = 0, width = frame.getWidth(); col < width; col++) {
for(var row = 0, height = frame.getHeight(); row < height; row++) {
var color = frame.getPixel(col, row);
if(color != Constants.TRANSPARENT_COLOR) {
context.fillStyle = color;
context.fillRect(col + offsetWidth, row + offsetHeight, 1, 1);
}
}
}
};
ns.SpritesheetRenderer.prototype.createCanvas_ = function () {
var frameCount = this.framesheet.getFrameCount();
if (frameCount > 0){
var width = frameCount * this.framesheet.getWidth();
var height = this.framesheet.getHeight();
return pskl.CanvasUtils.createCanvas(width, height);
} else {
throw "Cannot render empty Spritesheet";
}
};
})();

View File

@ -1,34 +0,0 @@
(function () {
var ns = $.namespace("pskl.selection");
ns.BaseSelection = function () {
this.reset();
};
ns.BaseSelection.prototype.reset = function () {
this.pixels = [];
this.hasPastedContent = false;
};
ns.BaseSelection.prototype.move = function (colDiff, rowDiff) {
var movedPixel, movedPixels = [];
for(var i=0, l=this.pixels.length; i<l; i++) {
movedPixel = this.pixels[i];
movedPixel.col += colDiff;
movedPixel.row += rowDiff;
movedPixels.push(movedPixel);
}
this.pixels = movedPixels;
};
ns.BaseSelection.prototype.fillSelectionFromFrame = function (targetFrame) {
var pixelWithCopiedColor;
for(var i=0, l=this.pixels.length; i<l; i++) {
pixelWithCopiedColor = this.pixels[i];
pixelWithCopiedColor.copiedColor =
targetFrame.getPixel(pixelWithCopiedColor.col, pixelWithCopiedColor.row);
}
this.hasPastedContent = true;
};
})();

View File

@ -1,9 +0,0 @@
(function () {
var ns = $.namespace("pskl.selection");
ns.RectangularSelection = function (x0, y0, x1, y1) {
this.pixels = pskl.PixelUtils.getRectanglePixels(x0, y0, x1, y1);
};
pskl.utils.inherit(ns.RectangularSelection, ns.BaseSelection);
})();

View File

@ -1,130 +0,0 @@
(function () {
var ns = $.namespace("pskl.selection");
ns.SelectionManager = function (framesheet, overlayFrame) {
this.framesheet = framesheet;
this.overlayFrame = overlayFrame;
this.currentSelection = null;
$.subscribe(Events.SELECTION_CREATED, $.proxy(this.onSelectionCreated_, this));
$.subscribe(Events.SELECTION_DISMISSED, $.proxy(this.onSelectionDismissed_, this));
$.subscribe(Events.SELECTION_MOVE_REQUEST, $.proxy(this.onSelectionMoved_, this));
$.subscribe(Events.PASTE, $.proxy(this.onPaste_, this));
$.subscribe(Events.COPY, $.proxy(this.onCopy_, this));
$.subscribe(Events.CUT, $.proxy(this.onCut_, this));
$.subscribe(Events.TOOL_SELECTED, $.proxy(this.onToolSelected_, this));
};
/**
* @private
*/
ns.SelectionManager.prototype.cleanSelection_ = function(selection) {
if(this.currentSelection) {
this.currentSelection.reset();
}
this.overlayFrame.clear();
};
/**
* @private
*/
ns.SelectionManager.prototype.onToolSelected_ = function(evt, tool) {
var isSelectionTool = tool instanceof pskl.drawingtools.BaseSelect;
if(!isSelectionTool) {
this.cleanSelection_();
}
};
/**
* @private
*/
ns.SelectionManager.prototype.onSelectionDismissed_ = function(evt) {
this.cleanSelection_();
};
/**
* @private
*/
ns.SelectionManager.prototype.onCut_ = function(evt) {
if(this.currentSelection) {
// Put cut target into the selection:
this.currentSelection.fillSelectionFromFrame(this.framesheet.getCurrentFrame());
var pixels = this.currentSelection.pixels;
var currentFrame = this.framesheet.getCurrentFrame();
for(var i=0, l=pixels.length; i<l; i++) {
try {
currentFrame.setPixel(pixels[i].col, pixels[i].row, Constants.TRANSPARENT_COLOR);
}
catch(e) {
// Catchng out of frame's bound pixels without testing
}
}
}
else {
throw "Bad state for CUT callback in SelectionManager";
}
};
ns.SelectionManager.prototype.onPaste_ = function(evt) {
if(this.currentSelection && this.currentSelection.hasPastedContent) {
var pixels = this.currentSelection.pixels;
var currentFrame = this.framesheet.getCurrentFrame();
for(var i=0, l=pixels.length; i<l; i++) {
try {
currentFrame.setPixel(
pixels[i].col, pixels[i].row,
pixels[i].copiedColor);
}
catch(e) {
// Catchng out of frame's bound pixels without testing
}
}
}
};
/**
* @private
*/
ns.SelectionManager.prototype.onCopy_ = function(evt) {
if(this.currentSelection && this.framesheet.getCurrentFrame()) {
this.currentSelection.fillSelectionFromFrame(this.framesheet.getCurrentFrame());
}
else {
throw "Bad state for CUT callback in SelectionManager";
}
};
/**
* @private
*/
ns.SelectionManager.prototype.onSelectionCreated_ = function(evt, selection) {
if(selection) {
this.currentSelection = selection;
var pixels = selection.pixels;
for(var i=0, l=pixels.length; i<l; i++) {
this.overlayFrame.setPixel(pixels[i].col, pixels[i].row, Constants.SELECTION_TRANSPARENT_COLOR);
}
}
else {
throw "No selection set in SelectionManager";
}
};
/**
* @private
*/
ns.SelectionManager.prototype.onSelectionMoved_ = function(evt, colDiff, rowDiff) {
if(this.currentSelection) {
this.currentSelection.move(colDiff, rowDiff);
}
else {
throw "Bad state: No currentSelection set when trying to move it in SelectionManager";
}
};
})();

View File

@ -1,9 +0,0 @@
(function () {
var ns = $.namespace("pskl.selection");
ns.ShapeSelection = function (pixels) {
this.pixels = pixels;
};
pskl.utils.inherit(ns.ShapeSelection, ns.BaseSelection);
})();

View File

@ -1,28 +0,0 @@
(function () {
var ns = $.namespace("pskl.service");
ns.HistoryService = function (framesheet) {
this.framesheet = framesheet;
};
ns.HistoryService.prototype.init = function () {
$.subscribe(Events.TOOL_RELEASED, this.saveState.bind(this));
$.subscribe(Events.UNDO, this.undo.bind(this));
$.subscribe(Events.REDO, this.redo.bind(this));
};
ns.HistoryService.prototype.saveState = function () {
this.framesheet.getCurrentFrame().saveState();
};
ns.HistoryService.prototype.undo = function () {
this.framesheet.getCurrentFrame().loadPreviousState();
$.publish(Events.FRAMESHEET_RESET);
};
ns.HistoryService.prototype.redo = function () {
this.framesheet.getCurrentFrame().loadNextState();
$.publish(Events.FRAMESHEET_RESET);
};
})();

View File

@ -1,64 +0,0 @@
(function () {
var ns = $.namespace("pskl.service");
ns.KeyboardEventService = function () {};
/**
* @private
*/
ns.KeyboardEventService.prototype.KeyboardActions_ = {
"ctrl" : {
"z" : Events.UNDO,
"y" : Events.REDO,
"x" : Events.CUT,
"c" : Events.COPY,
"v" : Events.PASTE
}
};
/**
* @private
*/
ns.KeyboardEventService.prototype.CharCodeToKeyCodeMap_ = {
90 : "z",
89 : "y",
88 : "x",
67 : "c",
86 : "v"
};
/**
* @private
*/
ns.KeyboardEventService.prototype.onKeyUp_ = function(evt) {
var isMac = false;
if (navigator.appVersion.indexOf("Mac")!=-1) {
// Welcome in mac world where vowels are consons and meta used instead of ctrl:
isMac = true;
}
if (isMac ? evt.metaKey : evt.ctrlKey) {
// Get key pressed:
var letter = this.CharCodeToKeyCodeMap_[evt.which];
if(letter) {
var eventToTrigger = this.KeyboardActions_.ctrl[letter];
if(eventToTrigger) {
$.publish(eventToTrigger);
evt.preventDefault();
return false;
}
}
}
};
/**
* @public
*/
ns.KeyboardEventService.prototype.init = function() {
$(document.body).keydown($.proxy(this.onKeyUp_, this));
};
})();

View File

@ -1,88 +0,0 @@
(function () {
var ns = $.namespace("pskl.service");
ns.LocalStorageService = function (framesheet_) {
if(framesheet_ === undefined) {
throw "Bad LocalStorageService initialization: <undefined frameSheet>";
}
this.framesheet = framesheet_;
this.localStorageThrottler_ = null;
};
/**
* @private
*/
ns.LocalStorageService.prototype.persistToLocalStorageRequest_ = function () {
// Persist to localStorage when drawing. We throttle localStorage accesses
// for high frequency drawing (eg mousemove).
if(this.localStorageThrottler_ !== null) {
window.clearTimeout(this.localStorageThrottler_);
}
this.localStorageThrottler_ = window.setTimeout($.proxy(function() {
this.persistToLocalStorage_();
this.localStorageThrottler_ = null;
}, this), 1000);
};
/**
* @private
*/
ns.LocalStorageService.prototype.persistToLocalStorage_ = function() {
console.log('[LocalStorage service]: Snapshot stored');
window.localStorage.snapShot = this.framesheet.serialize();
};
/**
* @private
*/
ns.LocalStorageService.prototype.restoreFromLocalStorage_ = function() {
this.framesheet.deserialize(window.localStorage.snapShot);
this.framesheet.setCurrentFrameIndex(0);
};
/**
* @private
*/
ns.LocalStorageService.prototype.cleanLocalStorage_ = function() {
console.log('[LocalStorage service]: Snapshot removed');
delete window.localStorage.snapShot;
};
/**
* @public
*/
ns.LocalStorageService.prototype.init = function(framesheet_) {
$.subscribe(Events.LOCALSTORAGE_REQUEST, $.proxy(this.persistToLocalStorageRequest_, this));
};
/**
* @public
*/
ns.LocalStorageService.prototype.displayRestoreNotification = function() {
if(window.localStorage && window.localStorage.snapShot) {
var reloadLink = "<a href='#' class='localstorage-restore onclick='pskl.app.restoreFromLocalStorage()'>reload</a>";
var discardLink = "<a href='#' class='localstorage-discard' onclick='pskl.app.cleanLocalStorage()'>discard</a>";
var content = "Non saved version found. " + reloadLink + " or " + discardLink;
$.publish(Events.SHOW_NOTIFICATION, [{
"content": content,
"behavior": $.proxy(function(rootNode) {
rootNode = $(rootNode);
rootNode.click($.proxy(function(evt) {
var target = $(evt.target);
if(target.hasClass("localstorage-restore")) {
this.restoreFromLocalStorage_();
}
else if (target.hasClass("localstorage-discard")) {
this.cleanLocalStorage_();
}
$.publish(Events.HIDE_NOTIFICATION);
}, this));
}, this)
}]);
}
};
})();

View File

@ -1,22 +0,0 @@
(function () {
var ns = $.namespace("pskl");
ns.CanvasUtils = {
createCanvas : function (width, height, classList) {
var canvas = document.createElement("canvas");
canvas.setAttribute("width", width);
canvas.setAttribute("height", height);
if (typeof classList == "string") {
classList = [classList];
}
if (Array.isArray(classList)) {
for (var i = 0 ; i < classList.length ; i++) {
canvas.classList.add(classList[i]);
}
}
return canvas;
}
};
})();

View File

@ -1,175 +0,0 @@
(function () {
var ns = $.namespace("pskl");
ns.PixelUtils = {
getRectanglePixels : function (x0, y0, x1, y1) {
var rectangle = this.getOrderedRectangleCoordinates(x0, y0, x1, y1);
var pixels = [];
for(var x = rectangle.x0; x <= rectangle.x1; x++) {
for(var y = rectangle.y0; y <= rectangle.y1; y++) {
pixels.push({"col": x, "row": y});
}
}
return pixels;
},
getBoundRectanglePixels : function (x0, y0, x1, y1) {
var rectangle = this.getOrderedRectangleCoordinates(x0, y0, x1, y1);
var pixels = [];
// Creating horizontal sides of the rectangle:
for(var x = rectangle.x0; x <= rectangle.x1; x++) {
pixels.push({"col": x, "row": rectangle.y0});
pixels.push({"col": x, "row": rectangle.y1});
}
// Creating vertical sides of the rectangle:
for(var y = rectangle.y0; y <= rectangle.y1; y++) {
pixels.push({"col": rectangle.x0, "row": y});
pixels.push({"col": rectangle.x1, "row": y});
}
return pixels;
},
/**
* Return an object of ordered rectangle coordinate.
* In returned object {x0, y0} => top left corner - {x1, y1} => bottom right corner
* @private
*/
getOrderedRectangleCoordinates : function (x0, y0, x1, y1) {
return {
x0 : Math.min(x0, x1), y0 : Math.min(y0, y1),
x1 : Math.max(x0, x1), y1 : Math.max(y0, y1),
};
},
/**
* Return the list of pixels that would have been filled by a paintbucket tool applied
* on pixel at coordinate (x,y).
* This function is not altering the Frame object argument.
*
* @param frame pskl.model.Frame The frame target in which we want to paintbucket
* @param col number Column coordinate in the frame
* @param row number Row coordinate in the frame
*
* @return an array of the pixel coordinates paint with the replacement color
*/
getSimilarConnectedPixelsFromFrame: function(frame, col, row) {
// To get the list of connected (eg the same color) pixels, we will use the paintbucket algorithm
// in a fake cloned frame. The returned pixels by the paintbucket algo are the painted pixels
// and are as well connected.
var fakeFrame = frame.clone(); // We just want to
var fakeFillColor = "sdfsdfsdf"; // A fake color that will never match a real color.
var paintedPixels = this.paintSimilarConnectedPixelsFromFrame(fakeFrame, col, row, fakeFillColor);
return paintedPixels;
},
/**
* Apply the paintbucket tool in a frame at the (col, row) initial position
* with the replacement color.
*
* @param frame pskl.model.Frame The frame target in which we want to paintbucket
* @param col number Column coordinate in the frame
* @param row number Row coordinate in the frame
* @param replacementColor string Hexadecimal color used to fill the area
*
* @return an array of the pixel coordinates paint with the replacement color
*/
paintSimilarConnectedPixelsFromFrame: function(frame, col, row, replacementColor) {
/**
* Queue linear Flood-fill (node, target-color, replacement-color):
* 1. Set Q to the empty queue.
* 2. If the color of node is not equal to target-color, return.
* 3. Add node to Q.
* 4. For each element n of Q:
* 5. If the color of n is equal to target-color:
* 6. Set w and e equal to n.
* 7. Move w to the west until the color of the node to the west of w no longer matches target-color.
* 8. Move e to the east until the color of the node to the east of e no longer matches target-color.
* 9. Set the color of nodes between w and e to replacement-color.
* 10. For each node n between w and e:
* 11. If the color of the node to the north of n is target-color, add that node to Q.
* 12. If the color of the node to the south of n is target-color, add that node to Q.
* 13. Continue looping until Q is exhausted.
* 14. Return.
*/
var paintedPixels = [];
var queue = [];
var dy = [-1, 0, 1, 0];
var dx = [0, 1, 0, -1];
var targetColor;
try {
targetColor = frame.getPixel(col, row);
} catch(e) {
// Frame out of bound exception.
}
if(targetColor == replacementColor) {
return;
}
queue.push({"col": col, "row": row});
var loopCount = 0;
var cellCount = frame.getWidth() * frame.getHeight();
while(queue.length > 0) {
loopCount ++;
var currentItem = queue.pop();
frame.setPixel(currentItem.col, currentItem.row, replacementColor);
paintedPixels.push({"col": currentItem.col, "row": currentItem.row });
for (var i = 0; i < 4; i++) {
var nextCol = currentItem.col + dx[i];
var nextRow = currentItem.row + dy[i];
try {
if (frame.containsPixel(nextCol, nextRow) && frame.getPixel(nextCol, nextRow) == targetColor) {
queue.push({"col": nextCol, "row": nextRow });
}
} catch(e) {
// Frame out of bound exception.
}
}
// Security loop breaker:
if(loopCount > 10 * cellCount) {
console.log("loop breaker called");
break;
}
}
return paintedPixels;
},
/**
* Calculate and return the maximal DPI to display a picture in a given container.
*
* @param container jQueryObject Container where the picture should be displayed
* @param number pictureHeight height in pixels of the picture to display
* @param number pictureWidth width in pixels of the picture to display
* @return number maximal dpi
*/
calculateDPIForContainer : function (container, pictureHeight, pictureWidth) {
return this.calculateDPI(container.height(), container.width(), pictureHeight, pictureWidth);
},
/**
* Calculate and return the maximal DPI to display a picture for a given height and width.
*
* @param height number Height available to display the picture
* @param width number Width available to display the picture
* @param number pictureHeight height in pixels of the picture to display
* @param number pictureWidth width in pixels of the picture to display
* @return number maximal dpi
*/
calculateDPI : function (height, width, pictureHeight, pictureWidth) {
var heightBoundDpi = Math.floor(height / pictureHeight),
widthBoundDpi = Math.floor(width / pictureWidth);
return Math.min(heightBoundDpi, widthBoundDpi);
},
};
})();

View File

@ -1,76 +0,0 @@
(function () {
var ns = $.namespace("pskl");
ns.UserSettings = {
SHOW_GRID : 'SHOW_GRID',
CANVAS_BACKGROUND : 'CANVAS_BACKGROUND',
KEY_TO_DEFAULT_VALUE_MAP_ : {
'SHOW_GRID' : false,
'CANVAS_BACKGROUND' : 'medium-canvas-background'
},
/**
* @private
*/
cache_ : {},
/**
* Static method to access a user defined settings value ot its default
* value if not defined yet.
*/
get : function (key) {
this.checkKeyValidity_(key);
if (!(key in this.cache_)) {
this.cache_[key] =
this.readFromLocalStorage_(key) || this.readFromDefaults_(key);
}
return this.cache_[key];
},
set : function (key, value) {
this.checkKeyValidity_(key);
this.cache_[key] = value;
this.writeToLocalStorage_(key, value);
$.publish(Events.USER_SETTINGS_CHANGED, [key, value]);
},
/**
* @private
*/
readFromLocalStorage_ : function(key) {
var value = window.localStorage[key];
if (typeof value != "undefined") {
value = JSON.parse(value);
}
return value;
},
/**
* @private
*/
writeToLocalStorage_ : function(key, value) {
// TODO(grosbouddha): Catch storage exception here.
window.localStorage[key] = JSON.stringify(value);
},
/**
* @private
*/
readFromDefaults_ : function (key) {
return this.KEY_TO_DEFAULT_VALUE_MAP_[key];
},
/**
* @private
*/
checkKeyValidity_ : function(key) {
if(!(key in this.KEY_TO_DEFAULT_VALUE_MAP_)) {
// TODO(grosbouddha): Define error catching strategy and throw exception from here.
console.log("UserSettings key <"+ key +"> not find in supported keys.");
}
}
};
})();

View File

@ -1,36 +0,0 @@
jQuery.namespace = function() {
var a=arguments, o=null, i, j, d;
for (i=0; i<a.length; i=i+1) {
d=a[i].split(".");
o=window;
for (j=0; j<d.length; j=j+1) {
o[d[j]]=o[d[j]] || {};
o=o[d[j]];
}
}
return o;
};
/*
* @provide pskl.utils
*
* @require Constants
*/
(function() { // namespace: pskl.utils
var ns = $.namespace("pskl.utils");
ns.rgbToHex = function(r, g, b) {
if (r > 255 || g > 255 || b > 255)
throw "Invalid color component";
return ((r << 16) | (g << 8) | b).toString(16);
};
ns.inherit = function(extendedObject, inheritFrom) {
extendedObject.prototype = Object.create(inheritFrom.prototype);
extendedObject.prototype.constructor = extendedObject;
extendedObject.prototype.superclass = inheritFrom.prototype;
};
})();

74
karma.conf.js Normal file
View File

@ -0,0 +1,74 @@
// Karma configuration
// Generated on Tue Jul 22 2014 23:49:26 GMT+0200 (Romance Daylight Time)
module.exports = function(config) {
var mapToSrcFolder = function (path) {return ['src', path].join('/');};
var piskelScripts = require('./src/piskel-script-list.js').scripts.map(mapToSrcFolder);
piskelScripts.push('test/js/testutils/**/*.js');
piskelScripts.push('test/js/**/*.js');
// Polyfill for Object.assign (missing in PhantomJS)
piskelScripts.push('./node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js');
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: piskelScripts.concat([
'./node_modules/promise-polyfill/promise.js'
]),
// list of files to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
});
};

101
misc/desktop/Info.plist Normal file
View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12C3006</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Piskel</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>nw.icns</string>
<key>CFBundleTypeName</key>
<string>node-webkit App</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.intel.nw.app</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>node-webkit</string>
<key>CFBundleIconFile</key>
<string>nw.icns</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Piskel</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>DTSDKBuild</key>
<string>11E52</string>
<key>DTSDKName</key>
<string>macosx10.7</string>
<key>DTXcode</key>
<string>0452</string>
<key>DTXcodeBuild</key>
<string>4G2008a</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>239963</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeDescription</key>
<string>node-webkit App</string>
<key>UTTypeIconFile</key>
<string>nw.icns</string>
<key>UTTypeIdentifier</key>
<string>com.intel.nw.app</string>
<key>UTTypeReferenceURL</key>
<string>https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>node-webkit</string>
<key>public.filename-extension</key>
<array>
<string>nw</string>
</array>
<key>public.mime-type</key>
<string>application/x-node-webkit-app</string>
</dict>
</dict>
</array>
</dict>
</plist>

BIN
misc/desktop/logo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
misc/desktop/nw.icns Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
{"modelVersion":2,"piskel":{"name":"low-colors-no-transparency","description":"","fps":12,"height":60,"width":60,"layers":["{\"name\":\"Layer 1\",\"frameCount\":2,\"base64PNG\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA8CAYAAACtrX6oAAABZUlEQVR4nO3cwRHCMAxE0RSUGlIF1TBDMTRAi1BCsCVZK/kf/n0n7xr5+FzXd6fe57lVR/YHBxhggAEGGGCA9yj7gwMMMMAAAwwwwHsEcPOWAR/Px22dgM/367bywP+grsbORl2NHQJsgY2GVoONhnYH9sSNQFbGjUB2A46AjYBWho2AdgFegeuFXAXXC9kMvBLXA7kSrgeyCTgD14pcDdeKDDDAergW5Iq4FuQp4GxYC3JV3FlkgAHWxZ1Brow7gwwwwACrFQacDemBXB13FBlggAFWDGCAAQYYYNkABhhggAGWLQRYFXlk/wiwKvLIfoABBlitUGA15NHto8BqyKPbAQZYF3lm9wywCvLMbv6qLII8uxlggPWQLXstwFnIlr3cJokjW7dyXSiM7LGT+2BBaM99XPiLIXtv440OEeioTbyyk4i9YgfvZDUP4OYB3DyAmwdw8wBuHsDNA7h5ADcP4Ob9AHU/4CXfXtXyAAAAAElFTkSuQmCC\"}"],"expanded":false}}

View File

@ -0,0 +1 @@
{"modelVersion":2,"piskel":{"name":"low-colors-with-transparency","description":"","fps":12,"height":60,"width":60,"layers":["{\"name\":\"Layer 1\",\"frameCount\":2,\"base64PNG\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAA8CAYAAACtrX6oAAABOUlEQVR4nO3bQWoDQQxEUR3Ix8lpAj5MTmovQsNgEmwYdZVG+h9q3+KtO4KIiIiIiIiIiIhoUN9fj7dr1O3n/ng39xvP9wlqI+xPUHtgn4G9IPQZ2OtBZ+JeADkTtzbyDtjC0Dtg60IrcAshK3DrICtxCyArcf3IDlwjsgPXiwxwY2AnrgHZiatHdsOKkd2wemQ3KsAbc4OKkd2gemQ3JsAAZ+bG1AK7IcXIbkg9shsRYIAzcyMCDHBybkSAAc7MjQgwwMm5EQEGODM3oh44oibyxtyQWtwIgAts570AF9jOe39zg4pwV25QLW4EwO2BI2ogC3PDanFXQ3BXs3AjAG4PHMHPhta4qyG4q1m4qyG4q1m4x5rDvjYH9tgQ3NUs3GPNYV+bA/tXTVH/awYqERERERERERFRVk8BxgukicHldgAAAABJRU5ErkJggg==\"}"],"expanded":false}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

68
misc/icons/SVG/eye.svg Normal file
View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="300"
height="140.00085"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="eye.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="-6.0052729"
inkscape:cy="93.159467"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1148"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-223.21875,-469.24915)">
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="m 373.21875,469.25 c -63.15236,-0.28299 -150,70 -150,70 0,0 78.75568,70 150,70 62.82091,0 150,-70 150,-70 0,0 -87.47199,-69.71981 -150,-70 z m -1.5,22.3125 c 27.44855,0 49.6875,22.23895 49.6875,49.6875 0,27.44855 -22.23895,49.6875 -49.6875,49.6875 C 344.2702,590.9375 322,568.69855 322,541.25 c 0,-27.44855 22.2702,-49.6875 49.71875,-49.6875 z m 0.0312,18.34375 c -17.85254,0 -32.34375,14.49121 -32.34375,32.34375 0,17.85254 14.49121,32.3125 32.34375,32.3125 17.85254,0 32.3125,-14.45996 32.3125,-32.3125 0,-17.85254 -14.45996,-32.34375 -32.3125,-32.34375 z"
id="path2987"
inkscape:export-filename="C:\Development\git\piskel\misc\icons\eye.png"
inkscape:export-xdpi="28.799999"
inkscape:export-ydpi="28.799999"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

88
misc/icons/SVG/flip.svg Normal file
View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="770.71875"
height="581.4375"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="mirror.svg"
inkscape:export-filename="C:\Development\git\piskel\src\img\tools\flip.png"
inkscape:export-xdpi="35.446629"
inkscape:export-ydpi="35.446629">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="612.40785"
inkscape:cy="222.08964"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1148"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-63.5625,-233.7818)">
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="m 359.2768,233.7907 -295.7143,581.4286 295.7143,0 z"
id="rect2987"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc"
inkscape:export-filename="C:\Development\git\piskel\src\img\tools\flip.png"
inkscape:export-xdpi="35.446629"
inkscape:export-ydpi="35.446629" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="m 538.5625,233.7818 295.71875,581.4375 -295.71875,0 0,-581.4375 z m 29.125,117.4375 0,434.28125 218.59375,0 L 567.6875,351.2193 z"
id="rect2987-1"
inkscape:connector-curvature="0"
inkscape:export-filename="C:\Development\git\piskel\src\img\tools\flip.png"
inkscape:export-xdpi="35.446629"
inkscape:export-ydpi="35.446629" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="m 435.5625,233.93805 0,41.28125 25.71875,0 0,-41.28125 -25.71875,0 z m 0,91.28125 0,40 25.71875,0 0,-40 -25.71875,0 z m 0,90 0,40 25.71875,0 0,-40 -25.71875,0 z m 0,90 0,40 25.71875,0 0,-40 -25.71875,0 z m 0,90 0,40 25.71875,0 0,-40 -25.71875,0 z m 0,90 0,40 25.71875,0 0,-40 -25.71875,0 z m 0,90 0,40 25.71875,0 0,-40 -25.71875,0 z"
id="rect3796"
inkscape:export-filename="C:\Development\git\piskel\src\img\tools\flip.png"
inkscape:export-xdpi="35.446629"
inkscape:export-ydpi="35.446629"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
inkscape:export-filename="C:\Users\Julian\Desktop\import-icon.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
sodipodi:docname="New document 1">
<defs
id="defs4">
<linearGradient
id="linearGradient3776"
osb:paint="solid">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3778" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="211.98241"
inkscape:cy="421.19661"
inkscape:document-units="px"
inkscape:current-layer="g3937"
showgrid="false"
inkscape:snap-bbox="true"
inkscape:object-nodes="false"
inkscape:object-paths="true"
inkscape:window-width="1920"
inkscape:window-height="1148"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g3937"
transform="matrix(0.09331433,0,0,0.09331433,132.76469,588.24921)"
style="stroke:#ffffff;stroke-opacity:1">
<g
id="g3959"
inkscape:export-filename="C:\Users\Julian\Desktop\import-icon.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<rect
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:30;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect2985"
width="384.28558"
height="384.28564"
x="161.42857"
y="249.50504"
ry="45.714287" />
<g
transform="matrix(1.1961461,0,0,2.4281875,-3.7905251,90.097124)"
id="g3765"
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-opacity:1">
<g
id="g3769"
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-opacity:1">
<path
sodipodi:nodetypes="cccczscscc"
inkscape:connector-curvature="0"
d="m 400,142.55868 -100,56.94635 -100,-57.33935 60,0.1965 c 0,0 0,-84.96745 0,-107.61226 0,-22.64481 55.79903,-25.2405808 80.01042,-22.177879 38.98433,4.931455 46.17248,30.649944 46.17248,30.649944 0,0 -46.97367,-31.662831 -46.18302,0.888182 0.65678,27.039499 0,98.252013 0,98.252013 z"
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:6;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3758" />
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

72
misc/icons/SVG/lasso.svg Normal file
View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="224.38731"
height="177.96065"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="New document 1">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.175"
inkscape:cx="-1542.2107"
inkscape:cy="-1434.6156"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1148"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-212.79148,-238.81242)">
<path
style="fill:none;stroke:#000000;stroke-width:15;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:30, 30;stroke-dashoffset:0"
d="m 429.0234,294.50503 c 0,26.68038 -49.13123,48.3091 -109.73768,48.3091 -60.60644,0 -110.61221,-39.48861 -96.16624,-73.3091 19.3392,-45.27639 60.80353,-4.92189 116.16624,-16.88052 101.16819,-21.85285 89.73768,15.20015 89.73768,41.88052 z"
id="path3761"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#000000;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 309.32357,338.9218 c 0,0 8.97064,20.56224 -30.34229,45.31736 -39.31294,24.75512 -40.99309,30.13484 -40.99309,30.13484"
id="path3764"
inkscape:connector-curvature="0"
sodipodi:nodetypes="czc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

62
misc/icons/SVG/layers.svg Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="90"
height="87.886002"
id="svg3024">
<defs
id="defs3026" />
<metadata
id="metadata3029">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-266.63206,-597.79217)"
id="layer1">
<g
transform="translate(262.14286,465.21932)"
id="Captions" />
<g
id="g3825" />
<g
transform="translate(-0.51079959,126.51585)"
id="layer1-9"
style="fill:#ffffff;fill-opacity:1">
<g
transform="translate(262.14286,465.21932)"
id="Captions-4"
style="fill:#ffffff;fill-opacity:1" />
<g
id="g3825-8"
style="fill:#ffffff;fill-opacity:1">
<path
d="m 357.14286,556.72132 c 0,1.346 -1.097,2.441 -2.442,2.441 h -60.239 c -1.347,0 -2.441,-1.096 -2.441,-2.441 v -4.555 h 50.241 c 4.346,0 7.884,-3.539 7.884,-7.885 v -48.128 h 4.555 c 1.346,0 2.442,1.096 2.442,2.441 v 58.127 z"
id="path2989-8"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m 279.58086,544.28132 v -4.555 h 6.997 2.722 2.721 37.803 c 4.346,0 7.884,-3.537 7.884,-7.883 v -35.69 -2.721 -2.721 -6.998 h 4.555 c 1.346,0 2.442,1.096 2.442,2.443 v 4.555 2.721 2.721 48.129 c 0,1.346 -1.097,2.443 -2.442,2.443 h -50.242 -2.721 -2.722 -4.555 c -1.347,0 -2.442,-1.098 -2.442,-2.444 z"
id="path2991-2"
style="fill:#ffffff;fill-opacity:1" />
<path
d="m 329.82386,471.27632 h -60.239 c -1.347,0 -2.442,1.093 -2.442,2.441 v 58.127 c 0,1.344 1.095,2.441 2.442,2.441 h 4.555 2.721 2.721 6.997 2.722 2.721 37.803 c 1.345,0 2.441,-1.098 2.441,-2.441 v -35.691 -2.721 -2.721 -6.998 -2.721 -2.721 -4.554 c -10e-4,-1.348 -1.098,-2.441 -2.442,-2.441 z"
id="path2993-4"
style="fill:#ffffff;fill-opacity:1" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

99
misc/icons/SVG/onion.svg Normal file
View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="484.83377"
height="430.80322"
id="svg3775"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="New document 3">
<defs
id="defs3777" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.04375"
inkscape:cx="-429.81362"
inkscape:cy="-202.97901"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1148"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata3780">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-108.38875,-334.08796)">
<g
id="g4409">
<g
id="g4402" />
<g
transform="translate(0,0.82903262)"
id="g4395">
<path
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:25;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
d="m 395.27679,333.25893 -27.75,24.625 -1.65625,-9 -15.87054,4.59375 0,30.6875 1.02679,21.75 16.5625,-14.6875 13.6875,-12.15625 c -0.38933,5.52995 -0.57204,11.36571 -0.1875,17.84375 0.60884,10.25666 3.42535,19.47486 9.03125,26.6875 5.6059,7.21264 13.15778,11.83264 21.53125,15.65625 16.74693,7.64722 37.6168,20.19024 63.19196,41.4465 48.42535,40.24771 54.41585,60.33492 63.14228,95.72811 8.30827,46.0064 -4.89609,79.1393 -23.94924,107.24539 -13.61329,20.08154 -30.46397,37.90172 -67.50554,45.41482 -37.04157,7.5131 -71.72672,9.9375 -96.53125,9.9375 l 0,25 c 26.40206,0 62.17269,-2.46078 101.5,-10.4375 39.32731,-7.97672 78.11592,-20.77325 101.8125,-45.5625 25.65093,-26.83371 50.16969,-75.46693 35.5,-151.5 l -0.0312,-0.125 -0.0312,-0.125 c -6.53497,-30.32511 -26.37349,-75.86993 -103.9375,-109.59375 -32.08342,-13.94946 -49.48883,-22.95257 -62.57589,-28.92857 -6.54353,-2.988 -10.31288,-6.85833 -12.36607,-9.5 -2.05319,-2.64167 -3.40095,-5.87935 -3.8125,-12.8125 -0.92607,-15.60085 1.34241,-27.46751 3.71875,-35.3125 2.37634,-7.84499 4.375,-10.875 4.375,-10.875 l -18.875,-16 z"
id="path3783-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccsssscssccsscccsssssccc" />
<path
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:25;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
d="m 368.02679,382.44643 c 0,0 -18.02679,-4.71234 -18.02679,1.3125 0,33.38646 -0.45698,39.28362 10.99554,62.875 11.45252,23.59138 26.22845,47.86253 48.53571,68.45982 42.18558,38.95183 38.76978,44.87254 45.77232,64.91071 2.57793,7.37689 3.66466,24.51253 1.875,37.96875 -1.78965,13.45623 -6.8081,31.21802 -13.40625,41.3125 -10.36811,15.86211 -18.71831,32.07642 -38.55357,43.09375 C 384.4983,713.88847 366.62548,716.375 350,716.375 l 0,25 c 20.82486,0 44.52967,-5.01706 69.5625,-15.125 25.03283,-10.10794 49.12742,-25.27054 63.71875,-47.59375 9.77369,-14.95272 20.06105,-37.72017 22.33202,-55.91561 2.27097,-18.19544 6.78209,-33.89274 -5.08281,-58.40387 -18.26325,-37.72918 -42.54947,-49.06002 -72.19845,-74.15863 -18.35479,-15.5378 -34.85805,-33.83125 -44.86772,-54.45046 -10.00967,-20.61921 -14.81706,-41.55822 -15.4375,-53.28125 z"
id="path3783-9-4-2"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csssszssccssssssc" />
<path
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:25;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
d="M 364.71429,398.50893 350,399.85268 c 0.74677,14.10988 0,43.14662 0,70.71875 0,13.09078 2.17726,28.99404 4.22321,39.97321 3.9423,21.15552 10.51352,34.8833 14.63393,48.16965 3.27485,10.5598 6.94665,25.34012 9.3884,31.02232 6.61244,15.3878 7.52886,34.1921 0.75446,55.84375 -6.86056,21.92704 -17.55684,42.94479 -35.42857,49.84375 L 350,716.625 c 25.86119,-9.9831 62.03992,-38.1333 71.93512,-69.75936 8.9188,-28.50537 3.28613,-54.26844 -4.84375,-73.1875 -4.92941,-11.47123 -9.61575,-19.37277 -14.86607,-28.9375 -6.46007,-11.76857 -20.1885,-26.52209 -24.11895,-38.53817 -3.57466,-10.92835 -7.82736,-24.14439 -8.92331,-37.66229 -2.1919,-27.03581 -3.63369,-54.77948 -4.46875,-70.03125 z"
id="path3783-9-4-4-8-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccsssssccsssssc" />
</g>
</g>
<path
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:25;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
d="m 306.33447,334.11887 27.75,24.625 1.65625,-9 15.87054,4.59375 0,30.6875 -1.02679,21.75 -16.5625,-14.6875 -13.6875,-12.15625 c 0.38933,5.52995 0.57204,11.36571 0.1875,17.84375 -0.60884,10.25666 0.61526,20.48501 -4.99064,27.69765 -5.6059,7.21264 -12.14763,16.88341 -20.5211,20.70702 -16.74693,7.64722 -36.60664,20.19024 -62.1818,41.4465 -48.42535,40.24771 -47.34479,51.24354 -56.07122,86.63673 -3.25751,47.01655 -5.92183,46.3581 4.75635,78.96112 6.45302,19.70261 22.38275,38.91187 59.42432,56.52649 34.13302,16.23151 85.86885,30.14056 110.67338,30.14056 l 0,25 c -26.40206,0 -62.17269,-2.46078 -101.5,-10.4375 -39.32731,-7.97672 -78.11592,-20.77325 -101.8125,-45.5625 -25.65093,-26.83371 -50.169693,-75.46693 -35.5,-151.5 l 0.0312,-0.125 0.0312,-0.125 c 6.53497,-30.32511 26.37349,-75.86993 103.9375,-109.59375 32.08342,-13.94946 49.48883,-22.95257 62.57589,-28.92857 6.54353,-2.988 10.31288,-6.85833 12.36607,-9.5 2.05319,-2.64167 3.40095,-5.87935 3.8125,-12.8125 0.92607,-15.60085 -1.34241,-27.46751 -3.71875,-35.3125 -2.37634,-7.84499 -4.375,-10.875 -4.375,-10.875 l 18.875,-16 z"
id="path3783-2-4"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccsssscssccsscccsssssccc" />
<path
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:25;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
d="m 343.97613,380.44701 9.00001,12.77232 c -0.74677,14.10988 0,43.14662 0,70.71875 0,13.09078 3.53703,30.42261 1.49108,41.40178 -3.9423,21.15552 -3.37067,28.45473 -7.49108,41.74108 -3.27485,10.5598 -6.94665,28.91155 -9.3884,34.59375 -6.61244,15.3878 -8.24315,50.62067 -1.46875,72.27232 6.86056,21.92704 11.12828,50.08764 21.85715,66.27232 l 3.98985,41.15013 C 338.24766,729.2435 314.3133,692.32754 304.4181,660.70148 c -8.9188,-28.50537 -8.28613,-78.55416 -0.15625,-97.47322 4.92941,-11.47123 9.61575,-22.9442 14.86607,-32.50893 6.46007,-11.76857 10.13774,-23.49163 13.05804,-36.51786 2.51528,-11.21964 6.93976,-29.49102 8.03571,-43.00892 2.1919,-27.03581 2.9194,-55.49377 3.75446,-70.74554 z"
id="path3783-9-4-4-8-8-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccsssssccsssssc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.5 KiB

Some files were not shown because too many files have changed in this diff Show More