implimented engine in sprite_map
This commit is contained in:
parent
80412b5c1d
commit
cebe25a460
@ -15,6 +15,14 @@ module Compass
|
|||||||
init_images
|
init_images
|
||||||
compute_image_positions!
|
compute_image_positions!
|
||||||
@height = @images.last.top + @images.last.height
|
@height = @images.last.top + @images.last.height
|
||||||
|
init_engine
|
||||||
|
end
|
||||||
|
|
||||||
|
def init_engine
|
||||||
|
@engine = eval("::Compass::SassExtensions::Sprites::#{modulize}Engine.new(nil, nil, nil)")
|
||||||
|
@engine.width = @width
|
||||||
|
@engine.height = @height
|
||||||
|
@engine.images = @images
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates the Sprite::Image objects for each image and calculates the width
|
# Creates the Sprite::Image objects for each image and calculates the width
|
||||||
@ -57,8 +65,8 @@ module Compass
|
|||||||
if kwargs.get_var('cleanup').value
|
if kwargs.get_var('cleanup').value
|
||||||
cleanup_old_sprites
|
cleanup_old_sprites
|
||||||
end
|
end
|
||||||
sprite_data = construct_sprite
|
engine.construct_sprite
|
||||||
save!(sprite_data)
|
save!
|
||||||
Compass.configuration.run_callback(:sprite_generated, sprite_data)
|
Compass.configuration.run_callback(:sprite_generated, sprite_data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -91,8 +99,8 @@ module Compass
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Saves the sprite engine
|
# Saves the sprite engine
|
||||||
def save!(output_png)
|
def save!
|
||||||
saved = output_png.save filename
|
saved = engine.save(filename)
|
||||||
Compass.configuration.run_callback(:sprite_saved, filename)
|
Compass.configuration.run_callback(:sprite_saved, filename)
|
||||||
saved
|
saved
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user