on master help sign in
Add `images` function.
commitbcfdf66ed964592419cb92ea331a3996a5775831 authorevancz <info@elm-lang.org> dateThu 13 Sep 2012, 12:25 (14 years ago) parent5fbc042
1 file changed+17−1
core-js/Graphics/Element.js+17−1
core-js/Graphics/Element.js+17−1
@@ -255,6 +255,22 @@ ElmCode.Graphics.Element = function() {
255255 }
256256 }
257257 }
258+ function images(srcs) {
259+ var pics = Elm.Input(spacer_66(0)(0));
260+ var update = Elm.Lift(function(src) {
261+ src = Foreign.JavaScript.castStringToJSString(src);
262+ var img = new Image();
263+ img.onload = function() {
264+ console.log('loaded');
265+ Dispatcher.notify(pics.id,
266+ image_57(this.width)(this.height)(src));
267+ };
268+ img.src = src;
269+ }, [srcs]);
270+ var combine = Elm.Lift(function(x) { return function(y) { return x; } },
271+ [pics,update]);
272+ return combine;
273+ }
258274 function video_58(w) {
259275 return function(h) {
260276 return function(src) {
@@ -489,6 +505,6 @@ ElmCode.Graphics.Element = function() {
489505 }
490506 }
491507 return{left:left_6, right:right_7, down:down_8, up:up_9, inward:inward_10, outward:outward_11, topLeft:topLeft_22, topRight:topRight_23, bottomLeft:bottomLeft_24, bottomRight:bottomRight_25, midLeft:midLeft_26, midRight:midRight_27, midTop:midTop_28, midBottom:midBottom_29, middle:middle_30, middleAt:middleAt, topLeftAt:topLeftAt_31, topRightAt:topRightAt_32, bottomLeftAt:bottomLeftAt_33, bottomRightAt:bottomRightAt_34, absolute:absolute_35, relative:relative_36, width:width_47, height:height_48, size:size_49, opacity:opacity_50,
492− color:color_51, link:link, widthOf:widthOf_52, heightOf:heightOf_53, sizeOf:sizeOf_54, text:text_56, asText:asText, plainText:plainText, centeredText:centeredText, justifiedText:justifiedText, rightedText:rightedText, image:image_57, video:video_58, fittedImage:fittedImage_59, flow:flow_60, above:above_61, below:below_62, beside:beside_63, layers:layers_64, collage:collage_65, spacer:spacer_66, container:container_67, line:line_76, segment:segment_77, polygon:polygon_79, rect:rect_80, oval:oval_81, circle:circle_82, ngon:ngon_83, solid:solid_89, dotted:dotted_90, dashed:dashed_91, customLine:customLine_92, filled:filled_93,
508+ color:color_51, link:link, widthOf:widthOf_52, heightOf:heightOf_53, sizeOf:sizeOf_54, text:text_56, asText:asText, plainText:plainText, centeredText:centeredText, justifiedText:justifiedText, rightedText:rightedText, image:image_57, images:images, video:video_58, fittedImage:fittedImage_59, flow:flow_60, above:above_61, below:below_62, beside:beside_63, layers:layers_64, collage:collage_65, spacer:spacer_66, container:container_67, line:line_76, segment:segment_77, polygon:polygon_79, rect:rect_80, oval:oval_81, circle:circle_82, ngon:ngon_83, solid:solid_89, dotted:dotted_90, dashed:dashed_91, customLine:customLine_92, filled:filled_93,
493509 outlined:outlined_94, customOutline:customOutline_95, textured:textured, sprite:sprite_96, toForm:toForm_97, rotate:rotate_98, scale:scale_99, move:move_100}
494510}();