{ "id": "153857", "key": "MOD-2179", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2015-12-15T19:54:37.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-08-21T18:19:00.000+0000", "status": { "description": "This issue is being actively worked on at the moment by the assignee.", "name": "In Progress", "id": "3", "statusCategory": { "id": 4, "key": "indeterminate", "colorName": "yellow", "name": "In Progress" } }, "components": [], "description": "Updating the Ti.Paint module to work along side the new 3D-Touch properties. Each section of the line's width is now sized properly ,depending on the force value. PR: https://github.com/appcelerator-modules/ti.paint/pull/14\r\n\r\n{code:javascript} \r\nvar Paint = require('ti.paint');\r\nvar win = Ti.UI.createWindow({ backgroundColor: '#fff' });\r\nvar win2 = Ti.UI.createWindow({ backgroundColor: 'white' });\r\n\r\nvar paintView = Paint.createPaintView({\r\n top \t\t\t:0,\r\n right \t\t\t:0,\r\n bottom \t\t\t:80,\r\n left \t\t\t:0,\r\n strokeColor \t:'black',\r\n strokeAlpha \t:255,\r\n eraseMode \t\t:false\r\n});\r\nwin.add(paintView);\r\n\r\n\r\nvar changeColor = Ti.UI.createButton({\r\n\tbottom \t:80,\r\n\tleft \t:10,\r\n\twidth \t:Ti.UI.SIZE,\r\n\theight \t:Ti.UI.SIZE,\r\n\ttitle \t:'changeColor'\r\n});\r\n\r\nchangeColor.addEventListener(\"click\",function(e){\r\n\tvar string = \"\";\r\n\tvar textArea = Ti.UI.createTextArea({\r\n \t\tborderWidth \t: 2,\r\n \t\tborderColor \t: '#bbb',\r\n \t\tborderRadius \t: 5,\r\n \t\tcolor \t\t\t: '#888',\r\n \t\tfont \t\t\t: {fontSize:20, fontWeight:'bold'},\r\n \t\tkeyboardType \t: Ti.UI.KEYBOARD_TYPE_DEFAULT,\r\n \t\treturnKeyType \t: Ti.UI.RETURNKEY_GO,\r\n \t\teditable \t\t: true\r\n\t});\r\n\r\n\twin.add(textArea);\r\n\ttextArea.addEventListener(\"blur\",function(e){\r\n\t\tstring = e.value;\r\n\t\tpaintView.strokeColor = string;\r\n\t\twin.remove(textArea);\r\n\r\n\t});\r\n});\r\n\r\nwin.add(changeColor);\r\n\r\n\r\nvar clear = Ti.UI.createButton({\r\n\tbottom:40,\r\n\tleft:140,\r\n\twidth:95,\r\n\theight:30,\r\n\ttitle:'Clear'\r\n});\r\nclear.addEventListener('click', function() {\r\n\tpaintView.clear();\r\n});\r\nwin.add(clear);\r\n\r\nvar buttonStrokeAlpha = Ti.UI.createButton({\r\n\tbottom \t:70,\r\n\tright \t:10,\r\n\twidth \t:100,\r\n\theight \t:30,\r\n\ttitle \t:'Alpha : 100%'\r\n});\r\n\r\nbuttonStrokeAlpha.addEventListener('click', function(e) {\r\n\tpaintView.strokeAlpha = 1.5;\r\n});\r\nwin.add(buttonStrokeAlpha);\r\n\r\nvar buttonStrokeColorEraser = Ti.UI.createButton({\r\n\tbottom \t:40,\r\n\tright \t:10,\r\n\twidth \t:100,\r\n\theight \t:30,\r\n\ttitle:'Erase : Off' });\r\n\r\nbuttonStrokeColorEraser.addEventListener('click', function(e) {\r\n\tpaintView.eraseMode = (paintView.eraseMode) ? false : true;\r\n\te.source.title = (paintView.eraseMode) ? 'Erase : On' : 'Erase : Off';\r\n});\r\n\r\nvar width = Ti.UI.createButton({\r\n\tbottom \t:40,\r\n\tleft \t:10,\r\n\twidth \t:Ti.UI.SIZE,\r\n\theight \t:30,\r\n\ttitle \t:'setwidthModifier'\r\n});\r\n\r\nwidth.addEventListener('click', function() { paintView.widthModifier = 2; });\r\nwin.add(width);\r\n\r\nvar saveBtn = Ti.UI.createButton({\r\n\tbottom \t:70,\r\n\tleft \t:140,\r\n\twidth \t:95,\r\n\theight \t:30,\r\n\ttitle \t:'save'\r\n});\r\n\r\n\r\nsaveBtn.addEventListener('click', function() {\r\n var sigImg = paintView.toImage(null,false);\r\n var filename = (\"Test_signature.bmp\");\r\n\r\n var label = Ti.UI.createLabel({\r\n \tbackgroundImage\t: sigImg,\r\n \ttitle \t\t\t: 'Click me!',\r\n \tcenter \t\t\t: 10,\r\n \twidth \t\t\t: 100,\r\n \theight\t\t\t: 100,\r\n \tborderColor \t:\"black\",\r\n \tborderRadius \t:2\r\n\t});\r\n\r\n\r\n\twin2.add(label);\r\n\twin2.open();\r\n\twin.close();\r\n});\r\nwin.add(saveBtn)\r\nwin.add(buttonStrokeColorEraser);\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "Update Ti.Paint Module to work with new 3D-Touch properties", "creator": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }