Blame view
dist/scripts/controllers/tshirtdesign.js
1.46 KB
ffc06a7f8
|
1 |
define(["app"],function(app){"use strict";app.controller("TshirtdesignCtrl",function($scope,$illustration){function onIllustrationChange(options){}function onllustrationSelected(options){$scope.currentObject=canvas.getActiveObject(),console.log(canvas.getActiveObject())}var canvas=new fabric.Canvas("main-design-container");fabric.Object.prototype.transparentCorners=!1,canvas.on("after:render",function(){}),canvas.on({"object:moving":onIllustrationChange,"object:scaling":onIllustrationChange,"object:rotating":onIllustrationChange,"object:selected":onllustrationSelected}),$scope.currentObject=null,$scope.changeIllustrationCategory=function(currentIllustration){$scope.currentIllustrationCate=$illustration.getList(currentIllustration),console.log($scope.currentIllustrationCate)},$scope.insertSvg=function(item){fabric.loadSVGFromURL(item.path,function(objects,options){var shape=fabric.util.groupSVGElements(objects,options);canvas.add(shape.scale(.6)),shape.set({left:150,top:200}).setCoords(),canvas.renderAll(),canvas.setActiveObject(shape)})},$scope.changeColorPattern=function(color){canvas.getActiveObject().set("fill",color),canvas.renderAll()},$scope.listColorPatterns=["#000000","#ffff00","#ff6600","#ff0000","#ff6262","#ffa19c","#ff9933","#c45d01","#5d2b03","#ffffcc","#000000","#ffff00","#ff6600","#ff0000","#ff6262","#ffa19c","#ff9933","#c45d01","#5d2b03","#ffffcc","#000000","#ffff00","#ff6600","#ff0000","#ff6262","#ffa19c","#ff9933","#c45d01","#5d2b03","#ffffcc","#ffffcc"]})}); |