ANSI resistor symbol added
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -8,3 +8,5 @@ test/svg/*
|
|||||||
test/library/*
|
test/library/*
|
||||||
*.bak
|
*.bak
|
||||||
*-cache.lib
|
*-cache.lib
|
||||||
|
qeda-*.tgz
|
||||||
|
*~
|
||||||
|
|||||||
43
src/symbol/ansi/common/icons.coffee
Normal file
43
src/symbol/ansi/common/icons.coffee
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
Icon = require '../../default/common/icon'
|
||||||
|
|
||||||
|
#
|
||||||
|
# Resistor
|
||||||
|
#
|
||||||
|
class ResistorIcon extends Icon
|
||||||
|
constructor: (symbol, element) ->
|
||||||
|
super symbol, element, width=10, height=4
|
||||||
|
@d =
|
||||||
|
w: @width
|
||||||
|
h: @height
|
||||||
|
d: @height/4
|
||||||
|
if @schematic.trimpot
|
||||||
|
@height = 2*@height + @d.d
|
||||||
|
@y1 = -@height/2 - @d.d
|
||||||
|
@y2 = @height/2
|
||||||
|
|
||||||
|
draw: (x, y) ->
|
||||||
|
settings = @symbol.settings
|
||||||
|
@symbol
|
||||||
|
.lineWidth @lineWidth
|
||||||
|
.center x, y # Set center to (x, y)
|
||||||
|
.line -@d.w/2, 0, (-@d.w/2)*(5/6), -@d.h/2
|
||||||
|
.line (-@d.w/2)*(5/6), -@d.h/2, (-@d.w/2)*(3/6), @d.h/2
|
||||||
|
.line (-@d.w/2)*(3/6), @d.h/2, (-@d.w/2)*(1/6), -@d.h/2
|
||||||
|
.line (-@d.w/2)*(1/6), -@d.h/2, (@d.w/2)*(1/6), @d.h/2
|
||||||
|
.line (@d.w/2)*(1/6), @d.h/2, (@d.w/2)*(3/6), -@d.h/2
|
||||||
|
.line (@d.w/2)*(3/6), -@d.h/2, (@d.w/2)*(5/6), @d.h/2
|
||||||
|
.line (@d.w/2)*(5/6), @d.h/2, (@d.w/2), 0
|
||||||
|
if @schematic.trimpot
|
||||||
|
@symbol
|
||||||
|
.line -@d.h, @d.h, @d.h, -@d.h
|
||||||
|
.line @d.h - @d.d, -@d.h - @d.d, @d.h + @d.d, -@d.h + @d.d
|
||||||
|
@symbol.center 0, 0 # Restore default center point
|
||||||
|
|
||||||
|
#
|
||||||
|
# Export object
|
||||||
|
#
|
||||||
|
Icons = {}
|
||||||
|
|
||||||
|
Icons.Resistor = ResistorIcon
|
||||||
|
|
||||||
|
module.exports = Icons
|
||||||
11
src/symbol/ansi/resistor.coffee
Normal file
11
src/symbol/ansi/resistor.coffee
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Icons = require './common/icons'
|
||||||
|
twoSided = require '../default/common/two-sided'
|
||||||
|
|
||||||
|
module.exports = (symbol, element, icons = Icons) ->
|
||||||
|
element.refDes = 'R'
|
||||||
|
symbol.orientations = [0, 90, 180, 270]
|
||||||
|
icon = new icons.Resistor(symbol, element)
|
||||||
|
|
||||||
|
twoSided symbol, element, icon
|
||||||
|
|
||||||
|
[icon.width, icon.height]
|
||||||
Reference in New Issue
Block a user